-
Notifications
You must be signed in to change notification settings - Fork 4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
aws-iam: Allow string | string[]
in FederatedPrincipal assumeRoleAction
#15908
Comments
Your proposed solution will not work, as But I agree this should be fixed, probably by adding a new field |
Thanks @rix0rrr , I am not familiar with jsii internals, so that helps 👍 |
@simonireilly Any ETA on the PR and release that fixes this issue? We currently need this functionality in our project and are using the workaround proposed here |
PR is open, awaiting comments: #16725 It's a fix, but not ideal. I think the other option is to rewrite entire IPrincipal to take a string[] instead of string in assume role action and publish under a feature flag. Awaiting comments for @rix0rrr |
To allow session tagging, the `sts:TagSession` permission needs to be added to the role's AssumeRolePolicyDocument. Introduce a new principal which enables this, and add a convenience method `.withSessionTags()` to the `PrincipalBase` class so all built-in principals will have this convenience method by default. To build this, we had to get rid of some cruft and assumptions around policy documents and statements, and defer more power to the `IPrincipal` objects themselves. In order not to break existing implementors, introduce a new interface `IAssumeRolePrincipal` which knows how to add itself to an AssumeRolePolicyDocument and gets complete freedom doing so. That same new interface could be used to lift some old limitations on `CompositePrincipal` so did that as well. Fixes #15908, closes #16725, fixes #2041, fixes #1578.
To allow session tagging, the `sts:TagSession` permission needs to be added to the role's AssumeRolePolicyDocument. Introduce a new principal which enables this, and add a convenience method `.withSessionTags()` to the `PrincipalBase` class so all built-in principals will have this convenience method by default. To build this, we had to get rid of some cruft and assumptions around policy documents and statements, and defer more power to the `IPrincipal` objects themselves. In order not to break existing implementors, introduce a new interface `IAssumeRolePrincipal` which knows how to add itself to an AssumeRolePolicyDocument and gets complete freedom doing so. That same new interface could be used to lift some old limitations on `CompositePrincipal` so did that as well. Fixes #15908, closes #16725, fixes #2041, fixes #1578. ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
|
Much obliged🙌 |
To allow session tagging, the `sts:TagSession` permission needs to be added to the role's AssumeRolePolicyDocument. Introduce a new principal which enables this, and add a convenience method `.withSessionTags()` to the `PrincipalBase` class so all built-in principals will have this convenience method by default. To build this, we had to get rid of some cruft and assumptions around policy documents and statements, and defer more power to the `IPrincipal` objects themselves. In order not to break existing implementors, introduce a new interface `IAssumeRolePrincipal` which knows how to add itself to an AssumeRolePolicyDocument and gets complete freedom doing so. That same new interface could be used to lift some old limitations on `CompositePrincipal` so did that as well. Fixes aws#15908, closes aws#16725, fixes aws#2041, fixes aws#1578. ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
Allow
string | string[]
in FederatedPrincipal.This is required when using cognito with principal tag mapping.
Use Case
AWS has a brief video explaining the use case here: https://www.youtube.com/watch?v=tAUmz94O2Qo
The use case is that, if a cognito user from a user pool is authenticated, then their claims can be forwarded to the policy document to allow for fine-grained access control e.g.
In order to support deploying FederatedPrincipal policies via
@aws-cdk/aws-iam
which usests:TagSession
andsts:AssumeRoleWithWebIdentity
currently this work around is required:The underlying base principal supports having the
this.assumeRoleAction
set as a string array, but the allowed types have been restricted on the child classaws-cdk/packages/@aws-cdk/aws-iam/lib/principals.ts
Lines 426 to 442 in fdce08c
Proposed Solution
aws-cdk/packages/@aws-cdk/aws-iam/lib/principals.ts
Line 427 in fdce08c
Is update to
Other
This is a 🚀 Feature Request
The text was updated successfully, but these errors were encountered: