Using the TIP plugin to access AWS services
Trusted identity propagation (TIP) is a feature of AWS IAM Identity Center that enables administrators of AWS 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 AWS resources. This context is propagated to other AWS services.
Identity context comprises information that AWS 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 AWS service to which access is requested (for example, Amazon Redshift), and the scope of access (for example, read only access). The receiving AWS 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 AWS IAM Identity Center User Guide.
The TIP plugin can be used with AWS services that support trusted identity propagation. As a reference use case, see Configuring an Amazon Q Business application using AWS IAM Identity Center in the Amazon Q Business User Guide.
Note
If you are using Amazon Q Business, see Configuring an Amazon Q Business application using AWS IAM Identity Center for service-specific instructions.
Prerequisites for using the TIP plugin
The following resources are required in order for the plugin to work:
-
You must be using either the AWS SDK for Java or the AWS 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 AWS managed applications that integrate with IAM Identity Center table in the AWS IAM Identity Center User Guide.
-
Enable IAM Identity Center and trusted identity propagation.
See TIP prerequisites and considerations in the AWS IAM Identity Center User Guide.
-
You must have an Identity-Center-integrated application.
See AWS managed applications or Customer managed applications in the AWS 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 AWS 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 AWS 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 asSsoOidcClient
for Java or client-sso-oidc
for JavaScript, with customer-defined configurations. If not provided, an OIDC client usingapplicationRoleArn
will be instantiated and used. -
stsClient
: (Optional) An AWS STS client with customer-defined configurations, used to assumeaccessRoleArn
with the user's identity context. If not provided, an AWS STS client usingapplicationRoleArn
will be instantiated and used. -
applicationRoleArn
: (Optional) The IAM role ARN to be assumed withAssumeRoleWithWebIdentity
so that the OIDC and AWS STS clients can be bootstrapped.-
If not provided, both of the
ssoOidcClient
andstsClient
parameters must be provided. -
If provided,
applicationRoleArn
can't be the same value as theaccessRoleArn
parameter.applicationRoleArn
is used to build the stsClient, which is used to assume accessRole. If the same role is used for bothapplicationRole
andaccessRole
, it would mean using a role to assume itself (self-role assumption), which is discouraged by AWS. 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
ssoOidcClient
andstsClient
:-
Credentials on the
ssoOidcClient
should haveoauth:CreateTokenWithIAM
permission for calling identity center to get the identity center specific user context. -
Credentials on
stsClient
should havests:AssumeRole
, andsts:SetContext
permissions onaccessRole
.accessRole
also needs to be configured with a trust relationship with the credentials onstsClient
.
-
-
If you are providing
applicationRoleArn
:-
applicationRole
should have theoauth:CreateTokenWithIAM
,sts:AssumeRole
andsts:SetContext
permissions on the required resources (IdC instance,accessRole
) as it will be used to build OIDC and STS clients. -
applicationRole
should have a trust relationship with the identity provider that is used to generate thewebToken
, as thewebToken
will be used to assume the applicationRole via the AssumeRoleWithWebIdentity call 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 AWS SDK for Java or the AWS SDK for JavaScript.