Maximo-curl-使用会话ID访问API

问题描述

我通过(感谢@Dex)登录Maximo

curl --head --request POST 'https://domain/maximo/oslc/login' --header 'maxauth:bWF4YWRtaW46bWF4YWRtaW4='

我得到了这个答复:

HTTP/1.1 302 Found
Date: Wed,26 Aug 2020 10:20:27 GMT
X-Powered-By: Servlet/3.0
Location: https://domain/maximo/webclient/login/login.jsp?appservauth=true
Content-Length: 0
Set-Cookie: WASPostParam=L21heGltby9vc2xjL2xvZ2lu.//////////8=.AAAAAA==.AA==; Path=/maximo/oslc/login; HttpOnly
Set-Cookie: WASReqURL=https:///maximo/oslc/login; Path=/; HttpOnly
Expires: Thu,01 Dec 1994 16:00:00 GMT
Cache-Control: no-cache="set-cookie,set-cookie2"
Content-Language: en-US

现在,我正在尝试重用上述cookie,以运行简单的REST API来检查我的登录信息

我正在尝试:

curl -v cookie "Token1=value1;Token2=value2" --request GET <domain>

以下是请求和响应:

  $ curl -v --cookie "WASPostParam=L21heGltby9vc2xjL2xvZ2lu.//////////8=.AAAAAA==.AA==; Path=/maximo/oslc/login; HttpOnly;WASReqURL=https:///maximo/oslc/login; Path=/; HttpOnly" --request GET https://domain/maximo/oslc/whoami
    Note: Unnecessary use of -X or --request,GET is already inferred.
      % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                     Dload  Upload   Total   Spent    Left  Speed
      0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0*   Trying 

149.29.121.154...
* TCP_NODELAY set
* Connected to domain (149.29.121.154) port 443 (#0)
* schannel: SSL/TLS connection with domain port 443 (step 1/3)
* schannel: checking server certificate revocation
* schannel: sending initial handshake data: sending 185 bytes...
* schannel: sent initial handshake data: sent 185 bytes
* schannel: SSL/TLS connection with domain port 443 (step 2/3)
* schannel: failed to receive handshake,need more data
* schannel: SSL/TLS connection with domain port 443 (step 2/3)
* schannel: encrypted data got 2732
* schannel: encrypted data buffer: offset 2732 length 4096
* schannel: received incomplete message,need more data
* schannel: SSL/TLS connection with domain port 443 (step 2/3)
* schannel: encrypted data got 1364
* schannel: encrypted data buffer: offset 4096 length 4096
* schannel: received incomplete message,need more data
* schannel: SSL/TLS connection with domain port 443 (step 2/3)
* schannel: encrypted data got 2
* schannel: encrypted data buffer: offset 4098 length 5120
* schannel: received incomplete message,need more data
* schannel: SSL/TLS connection with domain port 443 (step 2/3)
* schannel: encrypted data got 328
* schannel: encrypted data buffer: offset 4426 length 5122
* schannel: sending next handshake data: sending 158 bytes...
* schannel: SSL/TLS connection with domain port 443 (step 2/3)
* schannel: encrypted data got 51
* schannel: encrypted data buffer: offset 51 length 5122
* schannel: SSL/TLS handshake complete
* schannel: SSL/TLS connection with domain port 443 (step 3/3)
* schannel: stored credential handle in session cache
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0> GET /maximo/oslc/whoami HTTP/1.1
> Host: domain
> User-Agent: curl/7.55.1
> Accept: */*
> Cookie: WASPostParam=L21heGltby9vc2xjL2xvZ2lu.//////////8=.AAAAAA==.AA==; Path=/maximo/oslc/login; HttpOnly;WASReqURL=https:///maximo/oslc/login; Path=/; HttpOnly
>
* schannel: client wants to read 102400 bytes
* schannel: encdata_buffer resized 103424
* schannel: encrypted data buffer: offset 0 length 103424
* schannel: encrypted data got 409
* schannel: encrypted data buffer: offset 409 length 103424
* schannel: decrypted data length: 380
* schannel: decrypted data added: 380
* schannel: decrypted data cached: offset 380 length 102400
* schannel: encrypted data buffer: offset 0 length 103424
* schannel: decrypted data buffer: offset 380 length 102400
* schannel: schannel_recv cleanup
* schannel: decrypted data returned 380
* schannel: decrypted data buffer: offset 0 length 102400
< HTTP/1.1 302 Found
< Date: Wed,26 Aug 2020 10:44:21 GMT
< X-Powered-By: Servlet/3.0
< Location: https://domain/maximo/webclient/login/login.jsp?appservauth=true
< Content-Length: 0
< Set-Cookie: WASReqURL=https:///maximo/oslc/whoami; Path=/; HttpOnly
< Expires: Thu,01 Dec 1994 16:00:00 GMT
< Cache-Control: no-cache="set-cookie,set-cookie2"
< Content-Language: en-US
<
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
* Connection #0 to host domain left intact

该cookie是否应保存在文件中然后再使用?如果是这样,我可以获取curl命令来保存和重复使用cookie。我尝试了几种不同的选择,没有一种可行。

谢谢 R

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)

相关问答

错误1:Request method ‘DELETE‘ not supported 错误还原:...
错误1:启动docker镜像时报错:Error response from daemon:...
错误1:private field ‘xxx‘ is never assigned 按Alt...
报错如下,通过源不能下载,最后警告pip需升级版本 Requirem...