Using the TIP plugin to access Amazon Web Services services
Trusted identity propagation (TIP) is a feature of Amazon IAM Identity Center that enables administrators of Amazon Web Services services to grant permissions based on user attributes such as group associations. With trusted identity propagation, identity context is added to an IAM role to identify the user requesting access to Amazon resources. This context is propagated to other Amazon Web Services services.
Identity context comprises information that Amazon Web Services services use to make authorization decisions when they receive access requests. This information includes metadata that identifies the requester (for example, an IAM Identity Center user), the Amazon Web Services service to which access is requested (for example, Amazon Redshift), and the scope of access (for example, read only access). The receiving Amazon Web Services service uses this context, and any permissions assigned to the user, to authorize access to its resources. For more information, see in the Trusted identity propagation overview in the Amazon IAM Identity Center User Guide.
Prerequisites for using the TIP plugin
The following resources are required in order for the plugin to work:
-
You must be using either the Amazon SDK for Java or the Amazon SDK for JavaScript.
-
Verify that the service you are using supports the trusted identity propagation.
See the Enables trusted identity propagation through IAM Identity Center column of the Amazon managed applications that integrate with IAM Identity Center table in the Amazon IAM Identity Center User Guide.
-
Enable IAM Identity Center and trusted identity propagation.
See TIP prerequisites and considerations in the Amazon IAM Identity Center User Guide.
-
You must have an Identity-Center-integrated application.
See Amazon managed applications or Customer managed applications in the Amazon IAM Identity Center User Guide.
-
You must set up a trusted token issuer (TTI) and connect your service to IAM Identity Center.
See Prerequisites for trusted token issuers and Tasks for setting up a trusted token issuer in the Amazon IAM Identity Center User Guide.
To use the TIP plugin in your code
-
Create an instance of the trusted identity propagation plugin.
-
Create a service client instance for interacting with your Amazon Web Services service and customize the service client by adding the trusted identity propagation plugin.
The TIP plugin takes the following input parameters:
-
webTokenProvider: A function that the customer implements to obtain an OpenID token from their external identity provider. -
accessRoleArn: The IAM role ARN to be assumed by the plugin with the user's identity context to get the identity-enhanced credentials. -
applicationArn: The unique identifier string for the client or application. This value is an application ARN that has OAuth grants configured. -
ssoOidcClient: (Optional) An SSO OIDC client, such asSsoOidcClientfor Java or client-sso-oidcfor JavaScript, with customer-defined configurations. If not provided, an OIDC client usingapplicationRoleArnwill be instantiated and used. -
stsClient: (Optional) An Amazon STS client with customer-defined configurations, used to assumeaccessRoleArnwith the user's identity context. If not provided, an Amazon STS client usingapplicationRoleArnwill be instantiated and used. -
applicationRoleArn: (Optional) The IAM role ARN to be assumed withAssumeRoleWithWebIdentityso that the OIDC and Amazon STS clients can be bootstrapped.-
If not provided, both of the
ssoOidcClientandstsClientparameters must be provided. -
If provided,
applicationRoleArncan't be the same value as theaccessRoleArnparameter.applicationRoleArnis used to build the stsClient, which is used to assume accessRole. If the same role is used for bothapplicationRoleandaccessRole, it would mean using a role to assume itself (self-role assumption), which is discouraged by Amazon. See the announcementfor more details.
-
Considerations for ssoOidcClient, stsClient, and applicationRoleArn parameters
When configuring the TIP plugin, consider the following permission requirements based on which parameters you provide:
-
If you are providing
ssoOidcClientandstsClient:-
Credentials on the
ssoOidcClientshould haveoauth:CreateTokenWithIAMpermission for calling identity center to get the identity center specific user context. -
Credentials on
stsClientshould havests:AssumeRole, andsts:SetContextpermissions onaccessRole.accessRolealso needs to be configured with a trust relationship with the credentials onstsClient.
-
-
If you are providing
applicationRoleArn:-
applicationRoleshould have theoauth:CreateTokenWithIAM,sts:AssumeRoleandsts:SetContextpermissions on the required resources (IdC instance,accessRole) as it will be used to build OIDC and STS clients. -
applicationRoleshould have a trust relationship with the identity provider that is used to generate thewebToken, as thewebTokenwill be used to assume the applicationRole via the AssumeRoleWithWebIdentitycall by the plugin.
-
Example ApplicationRole configuration:
Trust Policy with Web token provider:
{ "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Principal": { "Federated": "arn:aws:iam::ACCOUNT_ID:oidc-provider/IDENTITY_PROVIDER_URL" }, "Action": "sts:AssumeRoleWithWebIdentity", "Condition": { "StringEquals": { "IDENTITY_PROVIDER_URL:aud": "CLIENT_ID_TO_BE_TRUSTED" } } } ] }
Permission Policy:
{ "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "sts:AssumeRole", "sts:SetContext" ], "Resource": [ "accessRoleArn" ] }, { "Effect": "Allow", "Action": [ "sso-oauth:CreateTokenWithIAM" ], "Resource": [ "*" ] } ] }
Code examples using TIP
The examples below show how to implement the TIP plugin in your code using the Amazon SDK for Java or the Amazon SDK for JavaScript.