Obtains the temporary identity credentials (STS token) to assume a RAM role during SAML role-based SSO by calling the AssumeRoleWithSAML operation.
Operation description
Before you begin
Ensure that you have obtained a SAML response from an external identity provider (IdP).
Ensure that you have created a SAML IdP in RAM. For more information, see Create a SAML IdP or CreateSAMLProvider.
Ensure that you have created a RAM role whose trusted entity is a SAML IdP in RAM. For more information, see Create a RAM role for a trusted IdP or CreateRole.
Try it now
Test
RAM authorization
Request parameters
|
Parameter |
Type |
Required |
Description |
Example |
| SAMLProviderArn |
string |
No |
The ARN of the SAML IdP created in RAM. Format: You can view the ARN of the IdP in the Resource Access Management (RAM) console or by calling API operations:
|
acs:ram::123456789012****:saml-provider/company1 |
| RoleArn |
string |
No |
The ARN of the RAM role to assume. The trusted entity of this role is a SAML IdP. For more information, see Create a RAM role for a trusted IdP or CreateRole. Format: You can view the ARN of the role in the Resource Access Management (RAM) console or by calling API operations:
|
acs:ram::123456789012****:role/adminrole |
| SAMLAssertion |
string |
No |
The Base64-encoded SAML assertion. The assertion must be 4 to 100,000 characters in length. Note
You must obtain the complete SAML response from the IdP. A separate SAML assertion field is not supported. |
base64_encoded_saml_assertion |
| Policy |
string |
No |
An additional access policy that is attached to the STS token to further restrict the permissions of the STS token. Rules:
The policy must be 1 to 2,048 characters in length. |
url_encoded_policy |
| DurationSeconds |
integer |
No |
The validity period of the STS token. Unit: seconds. The minimum validity period is 900 seconds, and the maximum validity period is the value of You can call the CreateRole or UpdateRole operation to set the maximum session duration ( |
3600 |
Because the AssumeRoleWithSAML operation uses SAML assertions for authentication and supports anonymous access, you do not need to provide the Signature, SignatureMethod, SignatureVersion, and AccessKeyId common request parameters. For more information about common request parameters, see Common request parameters.
Response elements
|
Element |
Type |
Description |
Example |
|
object |
The response elements. |
||
| RequestId |
string |
The request ID. |
6894B13B-6D71-4EF5-88FA-F32781734A7F |
| SAMLAssertionInfo |
object |
The partial information in the SAML assertion. |
|
| SubjectType |
string |
The format of |
persistent |
| Subject |
string |
The value of the |
alice@example.com |
| Issuer |
string |
The value of the |
http://example.com/adfs/services/trust |
| Recipient |
string |
The value of the |
https://signin.alibabacloud.com/saml-role/SSO |
| AssumedRoleUser |
object |
The temporary identity for role assumption. |
|
| AssumedRoleId |
string |
The ID of the temporary identity. |
34458433936495****:alice |
| Arn |
string |
The ARN of the temporary identity. |
acs:sts::123456789012****:assumed-role/AdminRole/alice |
| Credentials |
object |
The access credentials. |
|
| SecurityToken |
string |
The security token. Note
The length of the security token is not fixed. We strongly recommend that you do not limit the maximum length of the security token. |
******** |
| Expiration |
string |
The expiration time of the STS token in UTC. |
2015-04-09T11:52:19Z |
| AccessKeySecret |
string |
The AccessKey secret. |
wyLTSmsyPGP1ohvvw8xYgB29dlGI8KMiH2pK**** |
| AccessKeyId |
string |
The AccessKey ID. |
STS.L4aBSCSJVMuKg5U1**** |
| SourceIdentity |
string |
The source identity information. When you assume a role, you can specify the source identity of the actor as the initial identity identifier for the session. The value of the source identity persists throughout the chained sessions of continuous role assumption and cannot be changed midway. This ensures the traceability and security of operations. If the source identity is not specified, this field is not returned. |
Alice |
Examples
Success response
JSON format
{
"RequestId": "6894B13B-6D71-4EF5-88FA-F32781734A7F",
"SAMLAssertionInfo": {
"SubjectType": "persistent",
"Subject": "alice@example.com",
"Issuer": "http://example.com/adfs/services/trust",
"Recipient": "https://signin.alibabacloud.com/saml-role/SSO"
},
"AssumedRoleUser": {
"AssumedRoleId": "34458433936495****:alice",
"Arn": "acs:sts::123456789012****:assumed-role/AdminRole/alice"
},
"Credentials": {
"SecurityToken": "********",
"Expiration": "2015-04-09T11:52:19Z",
"AccessKeySecret": "wyLTSmsyPGP1ohvvw8xYgB29dlGI8KMiH2pK****",
"AccessKeyId": "STS.L4aBSCSJVMuKg5U1****"
},
"SourceIdentity": "Alice"
}
Error codes
|
HTTP status code |
Error code |
Error message |
Description |
|---|---|---|---|
| 500 | InternalError | STS Server Internal Error happened, please send the RequestId to us. | STS server internal exception |
See Error Codes for a complete list.
Release notes
See Release Notes for a complete list.