访问管理 根据 SAML 断言申请角色临时凭证

本接口(AssumeRoleWithSAML)用于根据 SAML 断言申请角色临时凭证。请求域名:sts.api.qcloud.com。

相关产品
访问管理 产品页,含版本规格、价格与购买入口。

一、接口描述

请求方式:HTTP POST。

二、输入参数

以下请求参数列表仅列出了接口请求参数,其余公共参数列表见 公共请求参数。

参数名称 必选 类型 描述
SAMLAssertion 是 String base64 编码的 SAML 断言信息
PrincipalArn 是 String 扮演者访问描述名
RoleArn 是 String 角色访问描述名
RoleSessionName 是 String 会话名称

三、输出参数

参数名称 类型 描述
credentials credentials 对象里面包含 token,tmpSecretId,tmpSecretKey 三元组
expiredTime Integer 证书无效的时间,返回 Unix 时间戳,精确到秒
expiration String 证书无效的时间,以 ISO8601 格式的 UTC 时间表示

四、Credentials 数据结构

字段 类型 描述
token String token 值
tmpSecretId String 临时安全证书 ID
tmpSecretKey String 临时安全证书 Key

五、示例

创建一个名称为 IdP 的 SAML 身份提供商。

输入示例:

POST /v2/index.php HTTP/1.1Host: sts.api.qcloud.comAccept: */*Content-Length: 3927Content-Type: application/x-www-form-urlencodedAction=AssumeRoleWithSAML&PrincipalArn=qcs::cam::uin/798950673:saml-provider/OneLogin&RoleArn=qcs::cam::uin/798950673:roleName/OneLogin-Role&RoleSessionName=test&SAMLAssertion=c2FtbCBhc3NlcnRpb24=&<公共请求参数>

输出示例:

{ "code": 0, "message": "", "codeDesc": "Success", "data": { "credentials": { "sessionToken": "d154fa74af184df**************3a3003d52f840001", "tmpSecretId": "************************************************************", "tmpSecretKey": "***********************************************************" }, "expiredTime": 1541594376, "expiration": "2018-11-07T12:39:36Z" }}

六、错误码

以下仅列出了接口业务逻辑相关的错误码,其他错误码详见 公共错误码。

错误码 描述
InvalidParameter.ProviderNotExist 身份提供商已存在
InvalidParameter.SAMLResponse 无效的 SAML 断言响应
InvalidParameter.InvalidRoleArn 无效的角色访问描述名
赞 (0)
上一篇 4天前
下一篇 4天前