-
Notifications
You must be signed in to change notification settings - Fork 125
Chore(Auth): Implementation of the custom auth with SRP parity testing use case #2167
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
Merged
Merged
Changes from 1 commit
Commits
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 hidden or 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 hidden or 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
73 changes: 73 additions & 0 deletions
73
..._that_Custom_Auth_signIn_invokes_proper_cognito_request_and_returns_custom_challenge.json
This file contains hidden or 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,73 @@ | ||
{ | ||
"description": "Test that Custom Auth signIn invokes proper cognito request and returns custom challenge", | ||
"preConditions": { | ||
"amplify-configuration": "authconfiguration.json", | ||
"state": "SignedOut_Configured.json", | ||
"mockedResponses": [ | ||
{ | ||
"type": "cognitoIdentityProvider", | ||
"apiName": "initiateAuth", | ||
"responseType": "success", | ||
"response": { | ||
"challengeName": "CUSTOM_CHALLENGE", | ||
"challengeParameters": { | ||
"SALT": "abc", | ||
"SECRET_BLOCK": "secretBlock", | ||
"SRP_B": "def", | ||
"USERNAME": "username" | ||
} | ||
} | ||
}, | ||
{ | ||
"type": "cognitoIdentityProvider", | ||
"apiName": "respondToAuthChallenge", | ||
"responseType": "success", | ||
"response": { | ||
"session": "someSession", | ||
"challengeName": "CUSTOM_CHALLENGE", | ||
"challengeParameters": { | ||
"SALT": "abc", | ||
"SECRET_BLOCK": "secretBlock", | ||
"SRP_B": "def", | ||
"USERNAME": "username" | ||
} | ||
} | ||
} | ||
] | ||
}, | ||
"api": { | ||
"name": "signIn", | ||
"params": { | ||
"username": "username", | ||
"password": "" | ||
}, | ||
"options": { | ||
"signInOptions": { | ||
"authFlow": "CUSTOM_AUTH_WITHOUT_SRP" | ||
} | ||
} | ||
}, | ||
"validations": [ | ||
{ | ||
"type": "amplify", | ||
"apiName": "signIn", | ||
"responseType": "success", | ||
"response": { | ||
"isSignedIn": false, | ||
"nextStep": { | ||
"signInStep": "CONFIRM_SIGN_IN_WITH_CUSTOM_CHALLENGE", | ||
"additionalInfo": { | ||
"SALT": "abc", | ||
"SECRET_BLOCK": "secretBlock", | ||
"SRP_B": "def", | ||
"USERNAME": "username" | ||
} | ||
} | ||
} | ||
}, | ||
{ | ||
"type": "state", | ||
"expectedState": "CustomSignIn_SigningIn.json" | ||
} | ||
] | ||
} |
74 changes: 74 additions & 0 deletions
74
...hat_Custom_Auth_signIn_invokes_proper_cognito_request_and_returns_password_challenge.json
This file contains hidden or 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,74 @@ | ||
{ | ||
"description": "Test that Custom Auth signIn invokes proper cognito request and returns password challenge", | ||
"preConditions": { | ||
"amplify-configuration": "authconfiguration.json", | ||
"state": "SignedOut_Configured.json", | ||
"mockedResponses": [ | ||
{ | ||
"type": "cognitoIdentityProvider", | ||
"apiName": "initiateAuth", | ||
"responseType": "success", | ||
"response": { | ||
"challengeName": "PASSWORD_VERIFIER", | ||
"challengeParameters": { | ||
"SALT": "abc", | ||
"SECRET_BLOCK": "secretBlock", | ||
"SRP_B": "def", | ||
"USERNAME": "username", | ||
"USER_ID_FOR_SRP": "userId" | ||
} | ||
} | ||
}, | ||
{ | ||
"type": "cognitoIdentityProvider", | ||
"apiName": "respondToAuthChallenge", | ||
"responseType": "success", | ||
"response": { | ||
"session": "someSession", | ||
"challengeName": "CUSTOM_CHALLENGE", | ||
"challengeParameters": { | ||
"SALT": "abc", | ||
"SECRET_BLOCK": "secretBlock", | ||
"SRP_B": "def", | ||
"USERNAME": "username" | ||
} | ||
} | ||
} | ||
] | ||
}, | ||
"api": { | ||
"name": "signIn", | ||
"params": { | ||
"username": "username", | ||
"password": "" | ||
}, | ||
"options": { | ||
"signInOptions": { | ||
"authFlow": "CUSTOM_AUTH_WITH_SRP" | ||
} | ||
} | ||
}, | ||
"validations": [ | ||
{ | ||
"type": "amplify", | ||
"apiName": "signIn", | ||
"responseType": "success", | ||
"response": { | ||
"isSignedIn": false, | ||
"nextStep": { | ||
"signInStep": "CONFIRM_SIGN_IN_WITH_CUSTOM_CHALLENGE", | ||
"additionalInfo": { | ||
"SALT": "abc", | ||
"SECRET_BLOCK": "secretBlock", | ||
"SRP_B": "def", | ||
"USERNAME": "username" | ||
} | ||
} | ||
} | ||
}, | ||
{ | ||
"type": "state", | ||
"expectedState": "CustomSignIn_SigningIn.json" | ||
} | ||
] | ||
} |
97 changes: 97 additions & 0 deletions
97
...ignIn/Test_that_Device_SRP_signIn_invokes_proper_cognito_request_and_returns_success.json
This file contains hidden or 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,97 @@ | ||
{ | ||
"description": "Test that Device SRP signIn invokes proper cognito request and returns success", | ||
"preConditions": { | ||
"amplify-configuration": "authconfiguration.json", | ||
"state": "SignedOut_Configured.json", | ||
"mockedResponses": [ | ||
{ | ||
"type": "cognitoIdentityProvider", | ||
"apiName": "initiateAuth", | ||
"responseType": "success", | ||
"response": { | ||
"challengeName": "PASSWORD_VERIFIER", | ||
"challengeParameters": { | ||
"SALT": "abc", | ||
"SECRET_BLOCK": "secretBlock", | ||
"SRP_B": "def", | ||
"USERNAME": "username", | ||
"USER_ID_FOR_SRP": "userId" | ||
} | ||
} | ||
}, | ||
{ | ||
"type": "cognitoIdentityProvider", | ||
"apiName": "respondToAuthChallenge", | ||
"responseType": "success", | ||
"response": { | ||
"authenticationResult": { | ||
"idToken": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJ1c2VySWQiLCJ1c2VybmFtZSI6InVzZXJuYW1lIiwiZXhwIjoxNTE2MjM5MDIyLCJvcmlnaW5fanRpIjoib3JpZ2luX2p0aSJ9.Xqa-vjJe5wwwsqeRAdHf8kTBn_rYSkDn2lB7xj9Z1xU", | ||
"accessToken": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJ1c2VySWQiLCJ1c2VybmFtZSI6InVzZXJuYW1lIiwiZXhwIjoxNTE2MjM5MDIyLCJvcmlnaW5fanRpIjoib3JpZ2luX2p0aSJ9.Xqa-vjJe5wwwsqeRAdHf8kTBn_rYSkDn2lB7xj9Z1xU", | ||
"refreshToken": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJ1c2VySWQiLCJ1c2VybmFtZSI6InVzZXJuYW1lIiwiZXhwIjoxNTE2MjM5MDIyLCJvcmlnaW5fanRpIjoib3JpZ2luX2p0aSJ9.Xqa-vjJe5wwwsqeRAdHf8kTBn_rYSkDn2lB7xj9Z1xU", | ||
"expiresIn": 300, | ||
"newDeviceMetadata": { | ||
"deviceKey": "someDeviceKey", | ||
"deviceGroupKey": "someDeviceGroupKey" | ||
} | ||
} | ||
} | ||
}, | ||
{ | ||
"type": "cognitoIdentityProvider", | ||
"apiName": "confirmDevice", | ||
"responseType": "success", | ||
"response": { | ||
} | ||
}, | ||
{ | ||
"type": "cognitoIdentity", | ||
"apiName": "getId", | ||
"responseType": "success", | ||
"response": { | ||
"identityId": "someIdentityId" | ||
} | ||
}, | ||
{ | ||
"type": "cognitoIdentity", | ||
"apiName": "getCredentialsForIdentity", | ||
"responseType": "success", | ||
"response": { | ||
"credentials": { | ||
"accessKeyId": "someAccessKey", | ||
"secretKey": "someSecretKey", | ||
"sessionToken": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJ1c2VySWQiLCJ1c2VybmFtZSI6InVzZXJuYW1lIiwiZXhwIjoxNTE2MjM5MDIyLCJvcmlnaW5fanRpIjoib3JpZ2luX2p0aSJ9.Xqa-vjJe5wwwsqeRAdHf8kTBn_rYSkDn2lB7xj9Z1xU", | ||
"expiration": 2342134 | ||
} | ||
} | ||
} | ||
] | ||
}, | ||
"api": { | ||
"name": "signIn", | ||
"params": { | ||
"username": "username", | ||
"password": "password" | ||
}, | ||
"options": { | ||
} | ||
}, | ||
"validations": [ | ||
{ | ||
"type": "amplify", | ||
"apiName": "signIn", | ||
"responseType": "success", | ||
"response": { | ||
"isSignedIn": true, | ||
"nextStep": { | ||
"signInStep": "DONE", | ||
"additionalInfo": { | ||
} | ||
} | ||
} | ||
}, | ||
{ | ||
"type": "state", | ||
"expectedState": "SignedIn_SessionEstablished.json" | ||
} | ||
] | ||
} |
Oops, something went wrong.
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.
Recommended to use
mapOf
as the last resort. Instead, use the actual Objects (Options object) for this instance. This way it is fault tolerant and easy when refactoring for example.