本帖最后由 Kevin517 于 2017-3-7 16:09 编辑
您好,我刚刚试了一次,还是 401 。
我通过 user password domain 获取了 Auth-Token 、X-Subject-Token 有一个 post 请求可以。但是 get 请求就是不行。
您看一下
在 Head 中 有
X-Subject-Token →gAAAAABYvmOX-vf67cmp8Hk3eFRn3Jqci6iJeeqAxjyP5K1tydIeQ99jKtoVHtGpPiwEfIsbsYUAxIAHZwTaMVNI8SWDrloukf4UM0xD-kncP78QUJklXQq5JhjKRubZLprXnCd3E-3yAWcq3Ti4PwalMpUN3A4hug
在 body 中 有 audit_ids
[mw_shl_code=python,true]{
"token": {
"issued_at": "2017-03-07T07:39:03.000000Z",
"audit_ids": [
"AAPiX_YQSIW2txbtwFRGrg"
],
"methods": [
"password"
],
"expires_at": "2017-03-07T08:39:03.505610Z",
"user": {
"domain": {
"id": "3a3eee072b0d4a15ba03df08a5f540d3",
"name": "000000"
},
"id": "6ffe6bd54997446facc93e22e65928f7",
"name": "admin"
}
}
}[/mw_shl_code]
当我使用 这两个 token 去做下面的 post 是可以的 。
POST
/v3/auth/tokens
Token authentication with unscoped authorization
close
Authenticates an identity and generates a token. Uses the token authentication method. Authorization is unscoped. In the request body, provide the token ID. Normal response codes: 201 Error response codes: 413,415,405,404,403,401,400,503,409 Request¶[td]Name | In | Type | Description | nocatalog (Optional) | query | string | (Since v3.1) The authentication response excludes the service catalog. By default, the response includes the service catalog. | identity | body | object | An identity object. | token | body | object | A token object. The token authentication method is used. This method is typically used in combination with a request to change authorization scope. | id | body | string | A token ID. | auth | body | object | An auth object. | methods | body | array | The authentication method. For token authentication, specify token. |
Request Example¶
[mw_shl_code=python,true]{
"auth": {
"identity": {
"methods": [
"token"
],
"token": {
"id": "'$OS_TOKEN'"
}
}
}
}[/mw_shl_code]
Response Parameters¶[td]Name | In | Type | Description | X-Subject-Token | header | string | The authentication token. An authentication response returns the token ID in this header rather than in the response body. | X-Auth-Token | header | string | A valid authentication token for an administrative user. |
post 使用了 上次 X-Subject-Token
这里会的到两个 audit_ids
[mw_shl_code=python,true]{
"token": {
"issued_at": "2017-03-07T07:50:30.000000Z",
"audit_ids": [
"j1rlM1EnRG2q_DjdGAx0DQ",
"AAPiX_YQSIW2txbtwFRGrg"
],
"methods": [
"token",
"password"
],
"expires_at": "2017-03-07T08:39:03.505610Z",
"user": {
"domain": {
"id": "3a3eee072b0d4a15ba03df08a5f540d3",
"name": "000000"
},
"id": "6ffe6bd54997446facc93e22e65928f7",
"name": "admin"
}
}
}[/mw_shl_code]
根据文档对 audit_ids 的说明,两个 token 其中一个是上次的,另一个是作为下次使用的。但是我进行 get 查询 /v3/auth/catalog 同样返回 401 。
|