Skip to content

Is It Possible to Use a Custom ProviderArn (e.g. Cognito) with AssumeRole for Identity-Enhanced Sessions?

0

Hello,

I’m experimenting with AWS’s identity-enhanced role sessions so that downstream services and CloudTrail can see the actual end-user identity rather than just the assumed role. The documentation illustrates how to propagate user context from IAM Identity Center into STS by calling AssumeRole with a ProvidedContexts assertion.

In my use-case, I'm trying to propagate the identities of customers using my application, for better auditing and fine-grained access control. Because these are identities of customers and not workforce identities, I’d prefer not to manage them in Identity Center, since from my understanding it's a bad practice. Instead, I’m wondering if it’s possible to onboard a different OIDC provider, such as Cognito, as a trusted context provider in IAM. In that scenario I could pass its JWT directly as the ContextAssertion when calling AssumeRole.

I tried to register my Cognito user pool as a OIDC provider using create-open-id-connect-provider, but using the resulting ARN in the AssumeRole call returned "Invalid ProviderArn".

My questions are as follows:

  1. Is it possible to use a Cognito user pool as a context provider for AssumeRole, in order to use identity-enhanced sessions?
  2. Is the only way to leverage Identity-Enhanced sessions is to use IAM Identity Center?
  3. If so, wouldn't it be a bad design practice to use custom facing identities through IAM Identity Center? Or is this the right way to do it?

Thank you!

1 Answer
-1

Based on the available information, it appears that using a custom ProviderArn such as Cognito with AssumeRole for identity-enhanced sessions is not currently supported. The identity-enhanced IAM role sessions are specifically designed to work with AWS IAM Identity Center (formerly known as AWS Single Sign-On).

  1. It is not possible to use a Cognito user pool as a context provider for AssumeRole to create identity-enhanced sessions. The ProviderArn for identity-enhanced sessions is specifically set to "arn:aws:iam::aws:contextProvider/IdentityCenter". Attempts to use a different ProviderArn, such as one from Cognito, will result in an "Invalid ProviderArn" error.

  2. Currently, the only way to leverage identity-enhanced sessions is through IAM Identity Center. The feature is tightly integrated with this service, allowing for the propagation of user identity information from IAM Identity Center to other AWS services.

  3. Using IAM Identity Center for customer-facing identities is generally not recommended. IAM Identity Center is primarily designed for workforce identities within an organization, not for managing external customer identities. For customer-facing applications, services like Amazon Cognito are more appropriate.

For your use case of propagating customer identities for better auditing and fine-grained access control, you might need to explore alternative solutions. While identity-enhanced sessions offer benefits for workforce identities, they are not designed for customer-facing scenarios.

You could consider implementing a custom solution that includes the necessary identity information in your application's requests to AWS services. This might involve passing identity information through request headers or parameters, and then configuring your AWS resources to log and use this information. However, this approach would not have the same level of integration with AWS services as identity-enhanced sessions.

Alternatively, you might want to explore other AWS services or features that could help achieve your goals of improved auditing and access control for customer identities, even if they don't use the specific mechanism of identity-enhanced sessions.
Sources
Identity-enhanced IAM role sessions - AWS IAM Identity Center
Configure Amazon Q Business with AWS IAM Identity Center trusted identity propagation | AWS Machine Learning Blog
Making authenticated Amazon Q Business API calls using IAM Identity Center - Amazon Q Business

answered a year ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.