src/AWSSDK.Extensions.CognitoAuthentication/CognitoUserAuthentication.cs
/// <summary>
/// Uses the properties of the RespondToNewPasswordRequiredRequest object to respond to the current new 
/// password required authentication challenge using an asynchronous call
/// </summary>
/// <param name="newPasswordRequest">RespondToNewPasswordRequiredRequest object containing the necessary 
/// parameters to respond to the current SMS MFA authentication challenge</param>
/// <returns>Returns the AuthFlowResponse object that can be used to respond to the next challenge, 
/// if one exists</returns>
Uses the properties of the RespondToNewPasswordRequiredRequest object to respond to the current new
password required authentication challenge using an asynchronous call
Uses the properties of the RespondToNewPasswordRequiredRequest object to respond to the current new password required authentication challenge using an asynchronous call
public void RespondToNewPasswordRequiredAsync(RespondToNewPasswordRequiredRequest newPasswordRequest, AsyncCallback<AuthFlowResponse> callback = null)
        {
            RespondToAuthChallengeRequest challengeRequest = new RespondToAuthChallengeRequest
            {
                ChallengeResponses = new Dictionary<string, string>
                    {
                        { CognitoConstants.ChlgParamNewPassword, newPasswordRequest.NewPassword},
                        { CognitoConstants.ChlgParamUsername, Username }
                    },
                Session = newPasswordRequest.SessionID,
                ClientId = ClientID,
                ChallengeName = ChallengeNameType.NEW_PASSWORD_REQUIRED
            };
            if (!string.IsNullOrEmpty(SecretHash))
            {
                challengeRequest.ChallengeResponses.Add(CognitoConstants.ChlgParamSecretHash, SecretHash);
            }
            Provider.RespondToAuthChallengeAsync(challengeRequest, r =>
            {
                if (r.Exception != null)
                {
                    callback?.Invoke(new AsyncResult<AuthFlowResponse>(null, r.Exception));
                    return;
                }
                RespondToAuthChallengeResponse challengeResponse = r.Response;
                UpdateSessionIfAuthenticationComplete(challengeResponse.ChallengeName, challengeResponse.AuthenticationResult);
                callback?.Invoke(new AsyncResult<AuthFlowResponse>(new AuthFlowResponse()
                {
                    SessionID = challengeResponse.Session,
                    ChallengeName = challengeResponse.ChallengeName,
                    AuthenticationResult = challengeResponse.AuthenticationResult,
                    ChallengeParameters = challengeResponse.ChallengeParameters,
                    ClientMetadata = new Dictionary<string, string>(challengeResponse.ResponseMetadata.Metadata)
                }, null));
            });
        }
public void RespondToNewPasswordRequiredAsync ( RespondToNewPasswordRequiredRequest newPasswordRequest , AsyncCallback < AuthFlowResponse > callback = null ) { RespondToAuthChallengeRequest challengeRequest = new RespondToAuthChallengeRequest { ChallengeResponses = new Dictionary < string , string > { { CognitoConstants . ChlgParamNewPassword , newPasswordRequest . NewPassword } , { CognitoConstants . ChlgParamUsername , Username } } , Session = newPasswordRequest . SessionID , ClientId = ClientID , ChallengeName = ChallengeNameType . NEW_PASSWORD_REQUIRED } ; if ( ! string . IsNullOrEmpty ( SecretHash ) ) { challengeRequest . ChallengeResponses . Add ( CognitoConstants . ChlgParamSecretHash , SecretHash ) ; } Provider . RespondToAuthChallengeAsync ( challengeRequest , r => { if ( r . Exception != null ) { callback ? . Invoke ( new AsyncResult < AuthFlowResponse > ( null , r . Exception ) ) ; return ; } RespondToAuthChallengeResponse challengeResponse = r . Response ; UpdateSessionIfAuthenticationComplete ( challengeResponse . ChallengeName , challengeResponse . AuthenticationResult ) ; callback ? . Invoke ( new AsyncResult < AuthFlowResponse > ( new AuthFlowResponse ( ) { SessionID = challengeResponse . Session , ChallengeName = challengeResponse . ChallengeName , AuthenticationResult = challengeResponse . AuthenticationResult , ChallengeParameters = challengeResponse . ChallengeParameters , ClientMetadata = new Dictionary < string , string > ( challengeResponse . ResponseMetadata . Metadata ) } , null ) ) ; } ) ; }
Uses the properties of the RespondToNewPasswordRequiredRequest object to respond to the current new
password required authentication challenge using an asynchronous call
Uses the properties of the RespondToNewPasswordRequiredRequest object to respond to the current new password required authentication challenge using an asynchronous call
Returns the AuthFlowResponse object that can be used to respond to the next challenge,
if one exists
Returns the AuthFlowResponse object that can be used to respond to the next challenge if one exists
newPasswordRequest
RespondToNewPasswordRequiredRequest
RespondToNewPasswordRequiredRequest object containing the necessary
parameters to respond to the current SMS MFA authentication challenge
RespondToNewPasswordRequiredRequest object containing the necessary parameters to respond to the current SMS MFA authentication challenge
callback
AsyncCallback<AuthFlowResponse>