/AWS1/IF_QST=>GETIDENTITYCONTEXT()¶
About GetIdentityContext¶
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.
Supported Regions
The GetIdentityContext API works only in regions that support at least one of these identity types:
-
Amazon Quick Sight native identity
-
IAM federated identity
-
Active Directory
To use this API successfully, call it in the same region where your user's identity resides. For example, if your user's identity is in us-east-1, make the API call in us-east-1. For more information about managing identities in Amazon Quick Sight, see Identity and access management in Amazon Quick Sight in the Amazon Quick Sight User Guide.
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 ProvidedContexts parameter with ProviderArn set to arn:aws:iam::aws:contextProvider/QuickSight and ContextAssertion set to the identity token received from this API.
The assumed role must allow the sts:SetContext action in addition to sts:AssumeRole in its trust relationship policy. The trust policy should include both actions for the principal that will be assuming the role.
Method Signature¶
METHODS /AWS1/IF_QST~GETIDENTITYCONTEXT
IMPORTING
!IV_AWSACCOUNTID TYPE /AWS1/QSTAWSACCOUNTID OPTIONAL
!IO_USERIDENTIFIER TYPE REF TO /AWS1/CL_QSTUSERIDENTIFIER OPTIONAL
!IV_NAMESPACE TYPE /AWS1/QSTNAMESPACE OPTIONAL
!IV_SESSIONEXPIRESAT TYPE /AWS1/QSTTIMESTAMP00 OPTIONAL
RETURNING
VALUE(OO_OUTPUT) TYPE REF TO /aws1/cl_qstgetidcontextrsp
RAISING
/AWS1/CX_QSTACCESSDENIEDEX
/AWS1/CX_QSTINTERNALFAILUREEX
/AWS1/CX_QSTINVPARAMVALUEEX
/AWS1/CX_QSTPRECONDNOTMETEX
/AWS1/CX_QSTRESOURCENOTFOUNDEX
/AWS1/CX_QSTTHROTTLINGEX
/AWS1/CX_QSTCLIENTEXC
/AWS1/CX_QSTSERVEREXC
/AWS1/CX_RT_TECHNICAL_GENERIC
/AWS1/CX_RT_SERVICE_GENERIC.
IMPORTING¶
Required arguments:¶
iv_awsaccountid TYPE /AWS1/QSTAWSACCOUNTID /AWS1/QSTAWSACCOUNTID¶
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.
io_useridentifier TYPE REF TO /AWS1/CL_QSTUSERIDENTIFIER /AWS1/CL_QSTUSERIDENTIFIER¶
The identifier for the user whose identity context you want to retrieve.
Optional arguments:¶
iv_namespace TYPE /AWS1/QSTNAMESPACE /AWS1/QSTNAMESPACE¶
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.
iv_sessionexpiresat TYPE /AWS1/QSTTIMESTAMP00 /AWS1/QSTTIMESTAMP00¶
The timestamp at which the session will expire.
RETURNING¶
oo_output TYPE REF TO /aws1/cl_qstgetidcontextrsp /AWS1/CL_QSTGETIDCONTEXTRSP¶
Examples¶
Syntax Example¶
This is an example of the syntax for calling the method. It includes every possible argument and initializes every possible value. The data provided is not necessarily semantically accurate (for example the value "string" may be provided for something that is intended to be an instance ID, or in some cases two arguments may be mutually exclusive). The syntax shows the ABAP syntax for creating the various data structures.
DATA(lo_result) = lo_client->getidentitycontext(
io_useridentifier = new /aws1/cl_qstuseridentifier(
iv_email = |string|
iv_userarn = |string|
iv_username = |string|
)
iv_awsaccountid = |string|
iv_namespace = |string|
iv_sessionexpiresat = '20150101000000.0000000'
).
This is an example of reading all possible response values
lo_result = lo_result.
IF lo_result IS NOT INITIAL.
lv_statuscode2 = lo_result->get_status( ).
lv_string = lo_result->get_requestid( ).
lv_string = lo_result->get_context( ).
ENDIF.