src/AWSSDK.Extensions.CognitoAuthentication/CognitoUserAuthentication.cs
/// <summary>
/// Uses the properties of the RespondToCustomChallengeRequest object to respond to the current 
/// custom authentication challenge using an asynchronous call
/// </summary>
/// <param name="customRequest">RespondToCustomChallengeRequest object containing the necessary parameters to
/// respond to the current custom 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 RespondToCustomChallengeRequest object to respond to the current
custom authentication challenge using an asynchronous call
Uses the properties of the RespondToCustomChallengeRequest object to respond to the current custom authentication challenge using an asynchronous call
public void RespondToCustomAuthAsync(RespondToCustomChallengeRequest customRequest, AsyncCallback<AuthFlowResponse> callback = null)
        {
            RespondToAuthChallengeRequest request = new RespondToAuthChallengeRequest()
            {
                ChallengeName = ChallengeNameType.CUSTOM_CHALLENGE,
                ClientId = ClientID,
                ChallengeResponses = new Dictionary<string, string>(customRequest.ChallengeParameters),
                Session = customRequest.SessionID
            };
            Provider.RespondToAuthChallengeAsync(request, r =>
            {
                if (r.Exception != null)
                {
                    callback?.Invoke(new AsyncResult<AuthFlowResponse>(null, r.Exception));
                    return;
                }
                RespondToAuthChallengeResponse authResponse = r.Response;
                UpdateSessionIfAuthenticationComplete(authResponse.ChallengeName, authResponse.AuthenticationResult);
                callback?.Invoke(new AsyncResult<AuthFlowResponse>(new AuthFlowResponse()
                {
                    SessionID = authResponse.Session,
                    ChallengeName = authResponse.ChallengeName,
                    AuthenticationResult = authResponse.AuthenticationResult,
                    ChallengeParameters = authResponse.ChallengeParameters,
                    ClientMetadata = new Dictionary<string, string>(authResponse.ResponseMetadata.Metadata)
                }, null));
            });
        }
public void RespondToCustomAuthAsync ( RespondToCustomChallengeRequest customRequest , AsyncCallback < AuthFlowResponse > callback = null ) { RespondToAuthChallengeRequest request = new RespondToAuthChallengeRequest ( ) { ChallengeName = ChallengeNameType . CUSTOM_CHALLENGE , ClientId = ClientID , ChallengeResponses = new Dictionary < string , string > ( customRequest . ChallengeParameters ) , Session = customRequest . SessionID } ; Provider . RespondToAuthChallengeAsync ( request , r => { if ( r . Exception != null ) { callback ? . Invoke ( new AsyncResult < AuthFlowResponse > ( null , r . Exception ) ) ; return ; } RespondToAuthChallengeResponse authResponse = r . Response ; UpdateSessionIfAuthenticationComplete ( authResponse . ChallengeName , authResponse . AuthenticationResult ) ; callback ? . Invoke ( new AsyncResult < AuthFlowResponse > ( new AuthFlowResponse ( ) { SessionID = authResponse . Session , ChallengeName = authResponse . ChallengeName , AuthenticationResult = authResponse . AuthenticationResult , ChallengeParameters = authResponse . ChallengeParameters , ClientMetadata = new Dictionary < string , string > ( authResponse . ResponseMetadata . Metadata ) } , null ) ) ; } ) ; }
Uses the properties of the RespondToCustomChallengeRequest object to respond to the current
custom authentication challenge using an asynchronous call
Uses the properties of the RespondToCustomChallengeRequest object to respond to the current custom 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
customRequest
RespondToCustomChallengeRequest
RespondToCustomChallengeRequest object containing the necessary parameters to
respond to the current custom authentication challenge
RespondToCustomChallengeRequest object containing the necessary parameters to respond to the current custom authentication challenge
callback
AsyncCallback<AuthFlowResponse>