"收到无效会话ID"运行API调用时出现错误消息
适用场景
- Brocade
- SANNAV
问题描述
- 使用登录API调用生成会话ID后、生成的会话ID将用于运行后续API调用、但
Invalid session id received
会引发错误消息。
[root@xxxxxxxx ~]# curl -k -H 'username: ' -H 'password: ' -H 'Content-Type: application/json' -X POST https://10.225.xx.xx/external-api/v1/login/
{"sessionId":"4a84bce3-b086-4df6-b209-fbff6a54bb55"}[root@xxxxxxxx ~]#
[root@xxxxxxxx ~]#
[root@xxxxxxxx ~]# curl -vv -k -H 'Authorization: 4a84bce3-b086-4df6-b209-fbff6a54bb55' -H 'Accept: application/json' -H 'Content-Type: application/json' -X GET https://10.225.xx.xx/external-api/v1/discovery/fabrics
Note: Unnecessary use of -X or --request, GET is already inferred.
* Trying 10.225.xx.xx...
* TCP_NODELAY set
* Connected to 10.225.xx.xx (10.225.xx.xx) port 443 (#0)
* ALPN, offering h2
.
.
.
* Connection #0 to host 10.225.xx.xx left intact
{"code":401,"errorMessage":"UnAuthorizedException","detailedErrorMessage":"Invalid authorization token in the request: {\"ResponseCode\":\"AUTHENTICATION_2017\",\"ResponseId\":\"authentication.sessionvalidation.invalidsessionid\",\"ResponseMessage\":\"Invalid session id received\"}"}
- 会话ID与执行初始登录的主机IP地址关联。 如果正在使用HTTPS代理、则IP地址可能会更改、并且会话ID将显示为无效。 但是、此主机未使用代理进行HTTPS。
- SANNAV日志仅包含一个对IP地址的引用:
authentication-rbac-mw - [INFO ] 2024-04-01 16:45:07.665 [http-nio-12009-exec-3] com.brocade.dcm.authentication.server.controller.AuthenticationController - Login Request from client : 10.1.xx.xx with isGlobal flag: [null]
authentication-rbac-mw - [INFO ] 2024-04-01 16:45:07.727 [http-nio-12009-exec-3] com.brocade.dcm.authentication.server.controller.AuthenticationController - Authentication successful and sessionId is e947f2c3-d66e-4c01-8655-cd05f129d9e0 for user ROuser, client 10.1.xx.xx
10.1.42.81 - - [01/Apr/2024:16:45:07 +0530] "POST /external-api/v1/login/ HTTP/2.0" 200 52 "-""curl/7.61.1"
- 如果此日期的会话ID已知,则它仍可用于后续REST命令,或者 可以注销。
- REST也可以在 不使用会话ID的无会话模式下使用。
- 也尝试了无会话身份验证,但 身份验证失败
invalid username and password error
。 但是、通过GUI控制台可以正常使用相同的凭据。
所有测试登录都以相同方式失败:
2024-04-23 16:29:51 curl -k -H 'Authorization: Basic ' -H 'Accept: application/json' -H 'Content-Type: application/json' -X GET https://10.225.xx.xx/external-api/v1/discovery/fabrics
SANNAV访问日志:
10.1.xx.xx - ROuser [23/Apr/2024:16:29:51 +0530] "GET /external-api/v1/discovery/fabrics HTTP/2.0" 401 148 "-""curl/7.61.1"
SANNAV身份验证日志:
authentication-rbac-mw - [INFO ] 2024-04-23 16:29:51.550 [http-nio-12009-exec-17] com.brocade.dcm.authentication.server.controller.AuthenticationController - Login Request from client : 10.1.xx.xx with isGlobal flag: [null]
authentication-rbac-mw - [INFO ] 2024-04-23 16:29:51.558 [http-nio-12009-exec-17] com.brocade.dcm.authentication.server.controller.AuthenticationController - Maximum session limit: 25, current session count: 8, current sessionLess count: 0 and totalSessionCount: 8
authentication-rbac-mw - [INFO ] 2024-04-23 16:29:51.558 [http-nio-12009-exec-17] com.brocade.dcm.authentication.server.shiro.DCMRealmAuthenticator - Primary authentication setting is Local Database and secondary authentication setting is None
authentication-rbac-mw - [INFO ] 2024-04-23 16:29:51.565 [http-nio-12009-exec-17] com.brocade.dcm.authentication.server.shiro.LocalDbRealm - Authentication status after verifying using MD5 encryption false
authentication-rbac-mw - [INFO ] 2024-04-23 16:29:51.572 [http-nio-12009-exec-17] com.brocade.dcm.authentication.server.shiro.DCMRealmAuthenticator - Done with primary authentication. Auth status: false, fallback status: 0
authentication-rbac-mw - [INFO ] 2024-04-23 16:29:51.572 [http-nio-12009-exec-17] com.brocade.dcm.authentication.server.shiro.DCMRealmAuthenticator - Falling back to local authentication false .....?
authentication-rbac-mw - [INFO ] 2024-04-23 16:29:51.572 [http-nio-12009-exec-17] com.brocade.dcm.authentication.server.shiro.DCMRealmAuthenticator - Login status for user ROuser after authentication and user role check: false Is locally Authenticated false
authentication-rbac-mw - [INFO ] 2024-04-23 16:29:51.572 [http-nio-12009-exec-17] com.brocade.dcm.authentication.server.shiro.DCMRealmAuthenticator - Authentication failed for user ROuser status 0
authentication-rbac-mw - [ERROR] 2024-04-23 16:29:51.572 [http-nio-12009-exec-17] com.brocade.dcm.authentication.server.shiro.DCMRealmAuthenticator - Authentication failed for user ROuser authType Local Database
authentication-rbac-mw - [ERROR] 2024-04-23 16:29:51.572 [http-nio-12009-exec-17] com.brocade.dcm.authentication.server.controller.AuthenticationController - Login failed! Authentication exception occured for client 10.1.xx.xx
org.apache.shiro.authc.AuthenticationException: Invalid username and password