in src/Amazon.Extensions.CognitoAuthentication/CognitoUserAuthentication.cs [552:591]
public virtual async Task<AuthFlowResponse> RespondToNewPasswordRequiredAsync(RespondToNewPasswordRequiredRequest newPasswordRequest, Dictionary<string, string> requiredAttributes, CancellationToken cancellationToken)
{
var challengeResponses = new Dictionary<string, string>()
{
{ CognitoConstants.ChlgParamNewPassword, newPasswordRequest.NewPassword},
{ CognitoConstants.ChlgParamUsername, Username }
};
if (requiredAttributes != null)
{
foreach (KeyValuePair<string, string> attribute in requiredAttributes)
{
challengeResponses.Add(attribute.Key, attribute.Value);
}
}
RespondToAuthChallengeRequest challengeRequest = new RespondToAuthChallengeRequest
{
ChallengeResponses = challengeResponses,
Session = newPasswordRequest.SessionID,
ClientId = ClientID,
ChallengeName = ChallengeNameType.NEW_PASSWORD_REQUIRED
};
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>()));
}