QuickSight / Client / get_identity_context
get_identity_context¶
- QuickSight.Client.get_identity_context(**kwargs)¶
Retrieves the identity context for a Quick Sight user in a specified namespace, allowing you to obtain identity tokens that can be used with identity-enhanced IAM role sessions to call identity-aware APIs.
Currently, you can call the following APIs with identity-enhanced Credentials
Supported Authentication Methods
This API supports Quick Sight native users, IAM federated users, and Active Directory users. For Quick Sight users authenticated by Amazon Web Services Identity Center, see Identity Center documentation on identity-enhanced IAM role sessions.
Getting Identity-Enhanced Credentials
To obtain identity-enhanced credentials, follow these steps:
Call the GetIdentityContext API to retrieve an identity token for the specified user.
Use the identity token with the STS AssumeRole API to obtain identity-enhanced IAM role session credentials.
Usage with STS AssumeRole
The identity token returned by this API should be used with the STS AssumeRole API to obtain credentials for an identity-enhanced IAM role session. When calling AssumeRole, include the identity token in the
ProvidedContextsparameter withProviderArnset toarn:aws:iam::aws:contextProvider/QuickSightandContextAssertionset to the identity token received from this API.The assumed role must allow the
sts:SetContextaction in addition tosts:AssumeRolein its trust relationship policy. The trust policy should include both actions for the principal that will be assuming the role.See also: AWS API Documentation
Request Syntax
response = client.get_identity_context( AwsAccountId='string', UserIdentifier={ 'UserName': 'string', 'Email': 'string', 'UserArn': 'string' }, Namespace='string', SessionExpiresAt=datetime(2015, 1, 1) )
- Parameters:
AwsAccountId (string) –
[REQUIRED]
The ID for the Amazon Web Services account that the user whose identity context you want to retrieve is in. Currently, you use the ID for the Amazon Web Services account that contains your Quick Sight account.
UserIdentifier (dict) –
[REQUIRED]
The identifier for the user whose identity context you want to retrieve.
Note
This is a Tagged Union structure. Only one of the following top level keys can be set:
UserName,Email,UserArn.UserName (string) –
The name of the user that you want to get identity context for.
Email (string) –
The email address of the user that you want to get identity context for.
UserArn (string) –
The Amazon Resource Name (ARN) of the user that you want to get identity context for.
Namespace (string) – The namespace of the user that you want to get identity context for. This parameter is required when the UserIdentifier is specified using Email or UserName.
SessionExpiresAt (datetime) – The timestamp at which the session will expire.
- Return type:
dict
- Returns:
Response Syntax
{ 'Status': 123, 'RequestId': 'string', 'Context': 'string' }
Response Structure
(dict) –
Status (integer) –
The HTTP status of the request.
RequestId (string) –
The Amazon Web Services request ID for this operation.
Context (string) –
The identity context information for the user. This is an identity token that should be used as the ContextAssertion parameter in the STS AssumeRole API call to obtain identity enhanced AWS credentials.
Exceptions