Skip to content
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(auth): Fix for missing session variable when custom auth is performed #2335

Merged
merged 6 commits into from
Mar 16, 2023
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ internal object SRPCognitoActions : SRPActions {
params.plus(KEY_DEVICE_KEY to it)
} ?: params

SRPEvent(SRPEvent.EventType.RespondPasswordVerifier(challengeParams, event.metadata))
SRPEvent(SRPEvent.EventType.RespondPasswordVerifier(challengeParams, event.metadata, initiateAuthResponse.session))
} ?: throw Exception("Auth challenge parameters are empty.")
else -> throw Exception("Not yet implemented.")
}
Expand Down Expand Up @@ -136,7 +136,7 @@ internal object SRPCognitoActions : SRPActions {
params.plus(KEY_DEVICE_KEY to it)
} ?: params

SRPEvent(SRPEvent.EventType.RespondPasswordVerifier(challengeParams, event.metadata))
SRPEvent(SRPEvent.EventType.RespondPasswordVerifier(challengeParams, event.metadata, initiateAuthResponse.session))
} ?: throw ServiceException(
"Auth challenge parameters are empty.",
AmplifyException.TODO_RECOVERY_SUGGESTION
Expand Down Expand Up @@ -193,6 +193,7 @@ internal object SRPCognitoActions : SRPActions {
clientId = configuration.userPool.appClient
challengeResponses = challengeParams
clientMetadata = event.metadata
session = event.session
pinpointEndpointId?.let { analyticsMetadata { analyticsEndpointId = it } }
encodedContextData?.let { userContextData { encodedData = it } }
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ internal class SRPEvent(val eventType: EventType, override val time: Date? = nul
) : EventType()
data class RespondPasswordVerifier(
val challengeParameters: Map<String, String>,
val metadata: Map<String, String>
val metadata: Map<String, String>,
val session: String?
) : EventType()

data class ThrowAuthError(val exception: Exception) : EventType()
Expand Down