-
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
fix(cognito-identitypool-alpha): inconvenient IdentityPoolProviderUrl.userPool() #29025
Merged
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
b516bf1
accept userPool and userPoolClient instead of string URL
Tietew c7407c8
fix jsii-rosetta error
Tietew 1a6f093
Merge branch 'main' into coginto-idpool-userpool-url
Tietew 7a7acab
Merge branch 'main' into coginto-idpool-userpool-url
Tietew f379a70
Merge branch 'main' into coginto-idpool-userpool-url
TheRealAmazonKendra d90abe2
Merge branch 'main' into coginto-idpool-userpool-url
mergify[bot] File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -440,7 +440,7 @@ describe('role mappings', () => { | |
const providerUrl = Fn.importValue('ProviderUrl'); | ||
expect(() => new IdentityPool(stack, 'TestIdentityPoolRoleMappingErrors', { | ||
roleMappings: [{ | ||
providerUrl: IdentityPoolProviderUrl.userPool(providerUrl), | ||
providerUrl: IdentityPoolProviderUrl.custom(providerUrl), | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This would change the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same as above. No affects in CloudFormation template. |
||
useToken: true, | ||
}], | ||
})).toThrowError('mappingKey must be provided when providerUrl.value is a token'); | ||
|
@@ -452,7 +452,7 @@ describe('role mappings', () => { | |
new IdentityPool(stack, 'TestIdentityPoolRoleMappingToken', { | ||
roleMappings: [{ | ||
mappingKey: 'theKey', | ||
providerUrl: IdentityPoolProviderUrl.userPool(providerUrl), | ||
providerUrl: IdentityPoolProviderUrl.custom(providerUrl), | ||
useToken: true, | ||
}], | ||
}); | ||
|
@@ -532,6 +532,8 @@ describe('role mappings', () => { | |
|
||
test('role mapping with rules configuration', () => { | ||
const stack = new Stack(); | ||
const pool = new UserPool(stack, 'Pool'); | ||
const client = pool.addClient('Client'); | ||
const adminRole = new Role(stack, 'adminRole', { | ||
assumedBy: new ServicePrincipal('admin.amazonaws.com'), | ||
}); | ||
|
@@ -557,6 +559,11 @@ describe('role mappings', () => { | |
}); | ||
const idPool = new IdentityPool(stack, 'TestIdentityPoolRoleMappingRules', { | ||
roleMappings: [{ | ||
mappingKey: 'cognito', | ||
providerUrl: IdentityPoolProviderUrl.userPool(pool, client), | ||
useToken: true, | ||
}, | ||
{ | ||
providerUrl: IdentityPoolProviderUrl.AMAZON, | ||
resolveAmbiguousRoles: true, | ||
rules: [ | ||
|
@@ -601,6 +608,16 @@ describe('role mappings', () => { | |
Ref: 'TestIdentityPoolRoleMappingRulesC8C07BC3', | ||
}, | ||
RoleMappings: { | ||
'cognito': { | ||
IdentityProvider: { | ||
'Fn::Join': ['', [ | ||
{ 'Fn::GetAtt': ['PoolD3F588B8', 'ProviderName'] }, | ||
':', | ||
{ Ref: 'PoolClient8A3E5EB7' }, | ||
]], | ||
}, | ||
Type: 'Token', | ||
}, | ||
'www.amazon.com': { | ||
AmbiguousRoleResolution: 'AuthenticatedRole', | ||
IdentityProvider: 'www.amazon.com', | ||
|
@@ -696,4 +713,4 @@ describe('role mappings', () => { | |
}, | ||
}); | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I know we're ok with breaking changes, but this seems like it would ruin anyone who was simply supplying a url here that was not connected to a specific
UserPool
orUserPoolCliet
construct. I'm not sure what the difference would be if theIdentityPoolProviderType
turns fromUSER_POOL
toCUSTOM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IdentityPoolProviderType
(IdentityPoolProviderUrl.type
) is not used since #16190 (implemented PR).Changing
.userPool(somthing)
to.custom(something)
makes no differences in CloudFormation template.