diff --git a/aws-auth-cognito/src/test/java/com/amplifyframework/auth/cognito/featuretest/generators/JsonGenerator.kt b/aws-auth-cognito/src/test/java/com/amplifyframework/auth/cognito/featuretest/generators/JsonGenerator.kt index b91a8981bf..837dd9116e 100644 --- a/aws-auth-cognito/src/test/java/com/amplifyframework/auth/cognito/featuretest/generators/JsonGenerator.kt +++ b/aws-auth-cognito/src/test/java/com/amplifyframework/auth/cognito/featuretest/generators/JsonGenerator.kt @@ -61,6 +61,6 @@ object JsonGenerator { } fun main() { - cleanDirectory() + // cleanDirectory() JsonGenerator.generate() } diff --git a/aws-auth-cognito/src/test/java/com/amplifyframework/auth/cognito/featuretest/generators/SerializationTools.kt b/aws-auth-cognito/src/test/java/com/amplifyframework/auth/cognito/featuretest/generators/SerializationTools.kt index 4484cd8695..0b2c34d7fb 100644 --- a/aws-auth-cognito/src/test/java/com/amplifyframework/auth/cognito/featuretest/generators/SerializationTools.kt +++ b/aws-auth-cognito/src/test/java/com/amplifyframework/auth/cognito/featuretest/generators/SerializationTools.kt @@ -24,6 +24,7 @@ import com.amplifyframework.auth.cognito.featuretest.serializers.CognitoIdentity import com.amplifyframework.auth.cognito.featuretest.serializers.CognitoIdentityProviderExceptionSerializer import com.amplifyframework.auth.cognito.featuretest.serializers.deserializeToAuthState import com.amplifyframework.auth.cognito.featuretest.serializers.serialize +import com.amplifyframework.auth.cognito.options.AWSCognitoAuthSignInOptions import com.amplifyframework.auth.result.AuthSessionResult import com.amplifyframework.statemachine.codegen.states.AuthState import com.google.gson.Gson @@ -56,7 +57,7 @@ fun writeFile(json: String, dirName: String, fileName: String) { } fun cleanDirectory() { - val directory = File("$basePath") + val directory = File(basePath) if (directory.exists()) { directory.deleteRecursively() } @@ -173,6 +174,7 @@ fun Any?.toJsonElement(): JsonElement { is String -> JsonPrimitive(this) is Instant -> JsonPrimitive(this.epochSeconds) is AuthException -> toJsonElement() + is AWSCognitoAuthSignInOptions -> toJsonElement() is CognitoIdentityProviderException -> Json.encodeToJsonElement( CognitoIdentityProviderExceptionSerializer, this diff --git a/aws-auth-cognito/src/test/java/com/amplifyframework/auth/cognito/featuretest/generators/authstategenerators/AuthStateJsonGenerator.kt b/aws-auth-cognito/src/test/java/com/amplifyframework/auth/cognito/featuretest/generators/authstategenerators/AuthStateJsonGenerator.kt index 538d3bddb5..d9dce558d4 100644 --- a/aws-auth-cognito/src/test/java/com/amplifyframework/auth/cognito/featuretest/generators/authstategenerators/AuthStateJsonGenerator.kt +++ b/aws-auth-cognito/src/test/java/com/amplifyframework/auth/cognito/featuretest/generators/authstategenerators/AuthStateJsonGenerator.kt @@ -101,5 +101,26 @@ object AuthStateJsonGenerator : SerializableProvider { AuthorizationState.SigningIn() ) + private val receivedCustomChallengeState = AuthState.Configured( + AuthenticationState.SigningIn( + SignInState.ResolvingChallenge( + SignInChallengeState.WaitingForAnswer( + AuthChallenge( + challengeName = "CUSTOM_CHALLENGE", + username = username, + session = "someSession", + parameters = mapOf( + "SALT" to "abc", + "SECRET_BLOCK" to "secretBlock", + "SRP_B" to "def", + "USERNAME" to "username" + ) + ) + ) + ) + ), + AuthorizationState.SigningIn() + ) + override val serializables: List = listOf(signedInState, signedOutState, receivedChallengeState) } diff --git a/aws-auth-cognito/src/test/java/com/amplifyframework/auth/cognito/featuretest/generators/testcasegenerators/SignInTestCaseGenerator.kt b/aws-auth-cognito/src/test/java/com/amplifyframework/auth/cognito/featuretest/generators/testcasegenerators/SignInTestCaseGenerator.kt index 7c01c3ec39..1ef909297e 100644 --- a/aws-auth-cognito/src/test/java/com/amplifyframework/auth/cognito/featuretest/generators/testcasegenerators/SignInTestCaseGenerator.kt +++ b/aws-auth-cognito/src/test/java/com/amplifyframework/auth/cognito/featuretest/generators/testcasegenerators/SignInTestCaseGenerator.kt @@ -27,6 +27,7 @@ import com.amplifyframework.auth.cognito.featuretest.ResponseType import com.amplifyframework.auth.cognito.featuretest.generators.SerializableProvider import com.amplifyframework.auth.cognito.featuretest.generators.authstategenerators.AuthStateJsonGenerator import com.amplifyframework.auth.cognito.featuretest.generators.toJsonElement +import com.amplifyframework.auth.cognito.options.AuthFlowType import kotlinx.serialization.json.JsonObject object SignInTestCaseGenerator : SerializableProvider { @@ -51,6 +52,21 @@ object SignInTestCaseGenerator : SerializableProvider { ).toJsonElement() ) + private val mockedInitiateAuthForCustomAuthWithoutSRPResponse = MockResponse( + CognitoType.CognitoIdentityProvider, + "initiateAuth", + ResponseType.Success, + mapOf( + "challengeName" to ChallengeNameType.CustomChallenge.toString(), + "challengeParameters" to mapOf( + "SALT" to "abc", + "SECRET_BLOCK" to "secretBlock", + "SRP_B" to "def", + "USERNAME" to username, + ) + ).toJsonElement() + ) + private val mockedRespondToAuthChallengeResponse = MockResponse( CognitoType.CognitoIdentityProvider, "respondToAuthChallenge", @@ -97,6 +113,19 @@ object SignInTestCaseGenerator : SerializableProvider { ).toJsonElement() ) + private val mockedCustomChallengeResponse = MockResponse( + CognitoType.CognitoIdentityProvider, + "respondToAuthChallenge", + ResponseType.Success, + mapOf( + "session" to "someSession", + "challengeName" to "CUSTOM_CHALLENGE", + "challengeParameters" to mapOf( + "Code" to "1234" + ) + ).toJsonElement() + ) + private val mockedIdentityIdResponse = MockResponse( CognitoType.CognitoIdentity, "getId", @@ -146,6 +175,23 @@ object SignInTestCaseGenerator : SerializableProvider { ).toJsonElement() ) + private val mockedSignInCustomAuthChallengeExpectation = ExpectationShapes.Amplify( + apiName = AuthAPI.signIn, + responseType = ResponseType.Success, + response = mapOf( + "isSignedIn" to false, + "nextStep" to mapOf( + "signInStep" to "CONFIRM_SIGN_IN_WITH_CUSTOM_CHALLENGE", + "additionalInfo" to mapOf( + "SALT" to "abc", + "SECRET_BLOCK" to "secretBlock", + "USERNAME" to "username", + "SRP_B" to "def" + ) + ) + ).toJsonElement() + ) + private val mockConfirmDeviceResponse = MockResponse( CognitoType.CognitoIdentityProvider, "confirmDevice", @@ -174,16 +220,6 @@ object SignInTestCaseGenerator : SerializableProvider { options = JsonObject(emptyMap()) ), validations = listOf( -// ExpectationShapes.Cognito( -// apiName = "signIn", -// // see [https://docs.aws.amazon.com/cognito-user-identity-pools/latest/APIReference/API_InitiateAuth.html] -// // see [https://docs.aws.amazon.com/cognito-user-identity-pools/latest/APIReference/API_RespondToAuthChallenge.html] -// request = mapOf( -// "clientId" to "testAppClientId", // This should be pulled from configuration -// "authFlow" to AuthFlowType.UserSrpAuth, -// "authParameters" to mapOf("username" to username, "SRP_A" to "123") -// ).toJsonElement() -// ), mockedSignInSuccessExpectation, ExpectationShapes.State("SignedIn_SessionEstablished.json") ) @@ -232,5 +268,32 @@ object SignInTestCaseGenerator : SerializableProvider { ) ) - override val serializables: List = listOf(baseCase, challengeCase, deviceSRPTestCase) + private val customAuthCase = FeatureTestCase( + description = "Test that Custom Auth signIn invokes proper cognito request and returns custom challenge", + preConditions = PreConditions( + "authconfiguration.json", + "SignedOut_Configured.json", + mockedResponses = listOf( + mockedInitiateAuthForCustomAuthWithoutSRPResponse, + mockedCustomChallengeResponse + ) + ), + api = API( + AuthAPI.signIn, + params = mapOf( + "username" to username, + "password" to "", + ).toJsonElement(), + options = mapOf( + "signInOptions" to + mapOf("authFlow" to AuthFlowType.CUSTOM_AUTH_WITHOUT_SRP.toString()) + ).toJsonElement() + ), + validations = listOf( + mockedSignInCustomAuthChallengeExpectation, + ExpectationShapes.State("CustomSignIn_SigningIn.json") + ) + ) + + override val serializables: List = listOf(baseCase, challengeCase, deviceSRPTestCase, customAuthCase) } diff --git a/aws-auth-cognito/src/test/java/featureTest/utilities/AuthOptionsFactory.kt b/aws-auth-cognito/src/test/java/featureTest/utilities/AuthOptionsFactory.kt index 3a80d136f4..0c386a6690 100644 --- a/aws-auth-cognito/src/test/java/featureTest/utilities/AuthOptionsFactory.kt +++ b/aws-auth-cognito/src/test/java/featureTest/utilities/AuthOptionsFactory.kt @@ -21,6 +21,8 @@ import com.amplifyframework.auth.cognito.featuretest.AuthAPI import com.amplifyframework.auth.cognito.featuretest.AuthAPI.resetPassword import com.amplifyframework.auth.cognito.featuretest.AuthAPI.signIn import com.amplifyframework.auth.cognito.featuretest.AuthAPI.signUp +import com.amplifyframework.auth.cognito.options.AWSCognitoAuthSignInOptions +import com.amplifyframework.auth.cognito.options.AuthFlowType import com.amplifyframework.auth.options.AuthConfirmResetPasswordOptions import com.amplifyframework.auth.options.AuthConfirmSignInOptions import com.amplifyframework.auth.options.AuthConfirmSignUpOptions @@ -59,7 +61,7 @@ object AuthOptionsFactory { AuthAPI.rememberDevice -> TODO() AuthAPI.resendSignUpCode -> AuthResendSignUpCodeOptions.defaults() AuthAPI.resendUserAttributeConfirmationCode -> AuthResendUserAttributeConfirmationCodeOptions.defaults() - signIn -> AuthSignInOptions.defaults() + signIn -> getSignInOptions(optionsData) AuthAPI.signInWithSocialWebUI -> AuthWebUISignInOptions.builder().build() AuthAPI.signInWithWebUI -> AuthWebUISignInOptions.builder().build() AuthAPI.signOut -> getSignOutOptions(optionsData) @@ -74,6 +76,17 @@ object AuthOptionsFactory { AuthAPI.getVersion -> TODO() } as T + private fun getSignInOptions(optionsData: JsonObject): AuthSignInOptions { + return if (optionsData.containsKey("signInOptions")) { + val authFlowType = AuthFlowType.valueOf( + ((optionsData["signInOptions"] as Map)["authFlow"] as JsonPrimitive).content + ) + AWSCognitoAuthSignInOptions.builder().authFlowType(authFlowType).build() + } else { + AuthSignInOptions.defaults() + } + } + private fun getSignUpOptions(optionsData: JsonObject): AuthSignUpOptions = AuthSignUpOptions.builder().userAttributes( (optionsData["userAttributes"] as Map).map { diff --git a/aws-auth-cognito/src/test/resources/feature-test/states/CustomSignIn_SigningIn.json b/aws-auth-cognito/src/test/resources/feature-test/states/CustomSignIn_SigningIn.json new file mode 100644 index 0000000000..e69e8f6662 --- /dev/null +++ b/aws-auth-cognito/src/test/resources/feature-test/states/CustomSignIn_SigningIn.json @@ -0,0 +1,26 @@ +{ + "type": "AuthState.Configured", + "AuthenticationState": { + "type": "AuthenticationState.SigningIn", + "SignInState": { + "type": "SignInState.ResolvingChallenge", + "SignInChallengeState": { + "type": "SignInChallengeState.WaitingForAnswer", + "authChallenge": { + "challengeName": "CUSTOM_CHALLENGE", + "username": "username", + "session": null, + "parameters": { + "SALT": "abc", + "SECRET_BLOCK": "secretBlock", + "SRP_B": "def", + "USERNAME": "username" + } + } + } + } + }, + "AuthorizationState": { + "type": "AuthorizationState.SigningIn" + } +} diff --git a/aws-auth-cognito/src/test/resources/feature-test/testsuites/fetchAuthSession/Test_that_API_is_called_with_given_payload_and_returns_successful_data.json b/aws-auth-cognito/src/test/resources/feature-test/testsuites/fetchAuthSession/Test_that_API_is_called_with_given_payload_and_returns_successful_data.json deleted file mode 100644 index aacf3ab58c..0000000000 --- a/aws-auth-cognito/src/test/resources/feature-test/testsuites/fetchAuthSession/Test_that_API_is_called_with_given_payload_and_returns_successful_data.json +++ /dev/null @@ -1,39 +0,0 @@ -{ - "description": "Test that API is called with given payload and returns successful data", - "preConditions": { - "amplify-configuration": "authconfiguration.json", - "state": "SignedIn_SessionEstablished.json", - "mockedResponses": [ - ] - }, - "api": { - "name": "fetchAuthSession", - "params": { - }, - "options": { - } - }, - "validations": [ - { - "type": "amplify", - "apiName": "fetchAuthSession", - "responseType": "success", - "response": { - "awsCredentialsResult": { - "accessKeyId": "someAccessKey", - "expiration": 2342134, - "secretAccessKey": "someSecretKey", - "sessionToken": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJ1c2VySWQiLCJ1c2VybmFtZSI6InVzZXJuYW1lIiwiZXhwIjoxNTE2MjM5MDIyLCJvcmlnaW5fanRpIjoib3JpZ2luX2p0aSJ9.Xqa-vjJe5wwwsqeRAdHf8kTBn_rYSkDn2lB7xj9Z1xU" - }, - "identityIdResult": "someIdentityId", - "isSignedIn": true, - "userPoolTokensResult": { - "accessToken": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJ1c2VySWQiLCJ1c2VybmFtZSI6InVzZXJuYW1lIiwiZXhwIjoxNTE2MjM5MDIyLCJvcmlnaW5fanRpIjoib3JpZ2luX2p0aSJ9.Xqa-vjJe5wwwsqeRAdHf8kTBn_rYSkDn2lB7xj9Z1xU", - "idToken": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJ1c2VySWQiLCJ1c2VybmFtZSI6InVzZXJuYW1lIiwiZXhwIjoxNTE2MjM5MDIyLCJvcmlnaW5fanRpIjoib3JpZ2luX2p0aSJ9.Xqa-vjJe5wwwsqeRAdHf8kTBn_rYSkDn2lB7xj9Z1xU", - "refreshToken": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJ1c2VySWQiLCJ1c2VybmFtZSI6InVzZXJuYW1lIiwiZXhwIjoxNTE2MjM5MDIyLCJvcmlnaW5fanRpIjoib3JpZ2luX2p0aSJ9.Xqa-vjJe5wwwsqeRAdHf8kTBn_rYSkDn2lB7xj9Z1xU" - }, - "userSubResult": "userId" - } - } - ] -} \ No newline at end of file diff --git a/aws-auth-cognito/src/test/resources/feature-test/testsuites/signIn/Test_that_Device_SRP_signIn_invokes_proper_cognito_request_and_returns_success.json b/aws-auth-cognito/src/test/resources/feature-test/testsuites/signIn/Test_that_Device_SRP_signIn_invokes_proper_cognito_request_and_returns_success.json deleted file mode 100644 index 6631e63727..0000000000 --- a/aws-auth-cognito/src/test/resources/feature-test/testsuites/signIn/Test_that_Device_SRP_signIn_invokes_proper_cognito_request_and_returns_success.json +++ /dev/null @@ -1,97 +0,0 @@ -{ - "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" - } - ] -} \ No newline at end of file diff --git a/aws-auth-cognito/src/test/resources/feature-test/testsuites/signIn/Test_that_SRP_signIn_invokes_proper_cognito_request_and_returns_SMS_challenge.json b/aws-auth-cognito/src/test/resources/feature-test/testsuites/signIn/Test_that_SRP_signIn_invokes_proper_cognito_request_and_returns_SMS_challenge.json deleted file mode 100644 index 5cc1ab4d0a..0000000000 --- a/aws-auth-cognito/src/test/resources/feature-test/testsuites/signIn/Test_that_SRP_signIn_invokes_proper_cognito_request_and_returns_SMS_challenge.json +++ /dev/null @@ -1,69 +0,0 @@ -{ - "description": "Test that SRP signIn invokes proper cognito request and returns SMS 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": "SMS_MFA", - "challengeParameters": { - "CODE_DELIVERY_DELIVERY_MEDIUM": "SMS", - "CODE_DELIVERY_DESTINATION": "+12345678900" - } - } - } - ] - }, - "api": { - "name": "signIn", - "params": { - "username": "username", - "password": "password" - }, - "options": { - } - }, - "validations": [ - { - "type": "amplify", - "apiName": "signIn", - "responseType": "success", - "response": { - "isSignedIn": false, - "nextStep": { - "signInStep": "CONFIRM_SIGN_IN_WITH_SMS_MFA_CODE", - "additionalInfo": { - }, - "codeDeliveryDetails": { - "destination": "+12345678900", - "deliveryMedium": "SMS" - } - } - } - }, - { - "type": "state", - "expectedState": "SigningIn_SigningIn.json" - } - ] -} \ No newline at end of file diff --git a/aws-auth-cognito/src/test/resources/feature-test/testsuites/signIn/Test_that_SRP_signIn_invokes_proper_cognito_request_and_returns_success.json b/aws-auth-cognito/src/test/resources/feature-test/testsuites/signIn/Test_that_SRP_signIn_invokes_proper_cognito_request_and_returns_success.json deleted file mode 100644 index 364b080df8..0000000000 --- a/aws-auth-cognito/src/test/resources/feature-test/testsuites/signIn/Test_that_SRP_signIn_invokes_proper_cognito_request_and_returns_success.json +++ /dev/null @@ -1,86 +0,0 @@ -{ - "description": "Test that 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 - } - } - }, - { - "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" - } - ] -} \ No newline at end of file