Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: allow optional idp arg into auth to allow provided auth role or…
… authenticated identity (#8609)
- Loading branch information
Showing
18 changed files
with
297 additions
and
85 deletions.
There are no files selected for viewing
31 changes: 31 additions & 0 deletions
31
...ages/amplify-graphql-auth-transformer/src/__tests__/__snapshots__/multi-auth.test.ts.snap
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 |
---|---|---|
@@ -0,0 +1,31 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`iam checks test that admin roles are added when functions have access to the graphql api 1`] = ` | ||
"## [Start] Authorization Steps. ** | ||
$util.qr($ctx.stash.put(\\"hasAuth\\", true)) | ||
#set( $inputFields = $util.parseJson($util.toJson($ctx.args.input.keySet())) ) | ||
#set( $isAuthorized = false ) | ||
#set( $allowedFields = [] ) | ||
#if( $util.authType() == \\"IAM Authorization\\" ) | ||
#set( $adminRoles = [\\"helloWorldFunction\\",\\"echoMessageFunction\\"] ) | ||
#foreach( $adminRole in $adminRoles ) | ||
#if( $ctx.identity.userArn.contains($adminRole) ) | ||
#return($util.toJson({})) | ||
#end | ||
#end | ||
#if( $ctx.identity.userArn == $ctx.stash.authRole ) | ||
#set( $isAuthorized = true ) | ||
#end | ||
#end | ||
#if( !$isAuthorized && $allowedFields.isEmpty() ) | ||
$util.unauthorized() | ||
#end | ||
#if( !$isAuthorized ) | ||
#set( $deniedFields = $util.list.copyAndRemoveAll($inputFields, $allowedFields) ) | ||
#if( $deniedFields.size() > 0 ) | ||
$util.error(\\"Unauthorized on \${deniedFields}\\", \\"Unauthorized\\") | ||
#end | ||
#end | ||
$util.toJson({\\"version\\":\\"2018-05-29\\",\\"payload\\":{}}) | ||
## [End] Authorization Steps. **" | ||
`; |
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
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
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
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
Oops, something went wrong.