/// <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> 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)); }); }
/// <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> public async Task <AuthFlowResponse> RespondToCustomAuthAsync(RespondToCustomChallengeRequest customRequest) { RespondToAuthChallengeRequest request = new RespondToAuthChallengeRequest() { ChallengeName = ChallengeNameType.CUSTOM_CHALLENGE, ClientId = ClientID, ChallengeResponses = new Dictionary <string, string>(customRequest.ChallengeParameters), Session = customRequest.SessionID }; RespondToAuthChallengeResponse authResponse = await Provider.RespondToAuthChallengeAsync(request).ConfigureAwait(false); UpdateSessionIfAuthenticationComplete(authResponse.ChallengeName, authResponse.AuthenticationResult); return(new AuthFlowResponse(authResponse.Session, authResponse.AuthenticationResult, authResponse.ChallengeName, authResponse.ChallengeParameters, new Dictionary <string, string>(authResponse.ResponseMetadata.Metadata))); }