in src/Amazon.Extensions.CognitoAuthentication/CognitoUserAuthentication.cs [450:484]
public async Task<AuthFlowResponse> RespondToMfaAuthAsync(RespondToMfaRequest mfaRequest, CancellationToken cancellationToken)
{
if (mfaRequest == null)
{
throw new ArgumentNullException(nameof(mfaRequest));
}
RespondToAuthChallengeRequest challengeRequest = new RespondToAuthChallengeRequest
{
ChallengeResponses = new Dictionary<string, string>
{
{ GetChallengeParamCodeName(mfaRequest.ChallengeNameType), mfaRequest.MfaCode},
{ CognitoConstants.ChlgParamUsername, Username }
},
Session = mfaRequest.SessionID,
ClientId = ClientID,
ChallengeName = mfaRequest.ChallengeNameType
};
if (!string.IsNullOrEmpty(SecretHash))
{
challengeRequest.ChallengeResponses.Add(CognitoConstants.ChlgParamSecretHash, SecretHash);
}
RespondToAuthChallengeResponse challengeResponse =
await Provider.RespondToAuthChallengeAsync(challengeRequest, cancellationToken).ConfigureAwait(false);
UpdateSessionIfAuthenticationComplete(challengeResponse.ChallengeName, challengeResponse.AuthenticationResult);
return new AuthFlowResponse(challengeResponse.Session,
challengeResponse.AuthenticationResult,
challengeResponse.ChallengeName,
challengeResponse.ChallengeParameters ?? new Dictionary<string, string>(),
new Dictionary<string, string>(challengeResponse.ResponseMetadata.Metadata ?? new Dictionary<string, string>()));
}