获取联邦认证scoped token
功能介绍
该接口可以用于通过联邦认证方式获取scoped token。
URI
POST /v3/auth/tokens
请求参数
|
参数 |
是否必选 |
参数类型 |
描述 |
|---|---|---|---|
|
Content-Type |
否 |
String |
该字段内容填为“application/json;charset=utf8”。 |
|
参数 |
是否必选 |
参数类型 |
描述 |
|---|---|---|---|
|
是 |
Object |
认证信息。 |
|
参数 |
是否必选 |
参数类型 |
描述 |
|---|---|---|---|
|
methods |
是 |
Array of strings |
认证方法,该字段内容为“token”。 |
|
是 |
Object |
联邦unscoped token的信息。 |
|
参数 |
是否必选 |
参数类型 |
描述 |
|---|---|---|---|
|
否 |
Object |
取值为domain时,表示获取的token可以跨区域使用,domain支持id和name,二选一即可。 |
|
|
否 |
Object |
取值为project时,表示获取的token仅能访问指定project下的资源,project支持id和name,二选一即可。 |
响应参数
|
参数 |
参数类型 |
描述 |
|---|---|---|
|
X-Subject-Token |
string |
签名后的scoped token。 |
|
参数 |
参数类型 |
描述 |
|---|---|---|
|
Object |
联邦认证的scoped token信息。 |
|
参数 |
参数类型 |
描述 |
|---|---|---|
|
methods |
Array of strings |
获取token的方式。 |
|
expires_at |
String |
token过期时间。 |
|
Array of objects |
服务目录信息。 |
|
|
Object |
获取token的用户所属的账号信息。如果获取token时请求体中scope参数设置为domain,则返回该字段。 |
|
|
Object |
获取token的用户所属账号的项目信息。如果获取token时请求体中scope参数设置为project,则返回该字段。 |
|
|
Array of objects |
token的权限信息。 |
|
|
Object |
获取token的用户信息。 |
|
|
issued_at |
String |
token下发时间。 |
|
参数 |
参数类型 |
描述 |
|---|---|---|
|
type |
String |
该接口所属服务。 |
|
id |
String |
服务ID。 |
|
name |
String |
服务名称。 |
|
Array of objects |
终端节点。 |
|
参数 |
参数类型 |
描述 |
|---|---|---|
|
url |
String |
终端节点的URL。 |
|
region |
String |
终端节点所属区域。 |
|
region_id |
String |
终端节点所属区域ID。 |
|
interface |
String |
接口类型,描述接口在该终端节点的可见性。值为“public”,表示该接口为公开接口。 |
|
id |
String |
终端节点ID。 |
|
参数 |
参数类型 |
描述 |
|---|---|---|
|
Object |
用户所属账号信息。 |
|
|
Object |
联邦身份认证信息。 |
|
|
id |
String |
用户ID。 |
|
name |
String |
用户名。 |
|
password_expires_at |
String |
密码过期时间(UTC时间),“”表示密码不过期。 |
请求示例
POST https://sample.domain.com/v3/auth/tokens
{
"auth": {
"identity": {
"methods": [
"token"
],
"token": {
"id": "MIIatAYJKoZIhvcNAQcCoIIapTCCGqECAQExDTALB..."
}
},
"scope": {
"domain": {
"id": "063bb260a480cecc0f36c0086bb6c..."
}
}
}
}
响应示例
状态码为 201 时:
创建成功。
响应Header参数: X-Subject-Token:MIIatAYJKoZIhvcNAQcCoIIapTCCGqECAQExDTALB...
响应Body参数:
{
"token": {
"expires_at": "2020-02-13T14:21:34.042000Z",
"methods": [
"token"
],
"catalog": [
{
"endpoints": [
{
"id": "d2983f677ce14f1e81cbb6a9345a1...",
"interface": "public",
"region": "*",
"region_id": "*",
"url": "https://sample.domain.com/v3"
}
],
"id": "fd631b3426cb40f0919091d5861d8...",
"name": "keystone",
"type": "identity"
}
],
"domain": {
"id": "06aa2260a480cecc0f36c0086bb6cfe0",
"name": "IAMDomain"
},
"roles": [
{
"id": "0",
"name": "te_admin"
},
{
"id": "0",
"name": "secu_admin"
}
],
"issued_at": "2020-02-12T14:21:34.042000Z",
"user": {
"OS-FEDERATION": {
"groups": [
{
"id": "06aa2260bb00cecc3f3ac0084a74038f",
"name": "admin"
}
],
"identity_provider": {
"id": "ACME"
},
"protocol": {
"id": "saml"
}
},
"domain": {
"id": "06aa2260a480cecc0f36c0086bb6cfe0",
"name": "IAMDomain"
},
"id": "LdQTDSC7zmJVIic3yaCbLBXDxPAdDxLg",
"name": "FederationUser",
"password_expires_at": ""
}
}
}
返回值
|
返回值 |
描述 |
|---|---|
|
201 |
创建成功。 |
|
400 |
参数无效。 |
|
401 |
认证失败。 |
|
403 |
没有操作权限。 |
|
404 |
未找到相应的资源。 |
|
500 |
内部服务错误。 |
|
503 |
服务不可用。 |
错误码
无