public static ContextualSecurityToken OTPGateChallengeResponse(WorkflowAuthenticationResponse gateResponse, ref AuthenticationRequiredException authNException, out WorkflowAuthenticationChallenge workflowAuthenticationChallenge) { AuthenticationChallengeResponseType[] authenticationChallengeResponses = null; if (gateResponse != null) { AuthenticationChallengeResponseType authenticationChallengeResponse = new AuthenticationChallengeResponseType(); authenticationChallengeResponse.Response = new ClientSerializer( typeof(WorkflowAuthenticationResponse)).WriteObjectToXmlElement(gateResponse); authenticationChallengeResponses = new AuthenticationChallengeResponseType[] { authenticationChallengeResponse }; } ContextualSecurityToken authNSecurityToken = null; workflowAuthenticationChallenge = null; try { MessageBuffer messageBuffer; authNSecurityToken = authNException.Authenticate(authenticationChallengeResponses, out messageBuffer); } catch (AuthenticationRequiredException exception) { authNException = exception; workflowAuthenticationChallenge = (WorkflowAuthenticationChallenge) new Microsoft.ResourceManagement.Client.ClientSerializer( typeof(WorkflowAuthenticationChallenge)).ReadObjectFromXmlNode( authNException.AuthenticationChallenges[0].Challenge); } return(authNSecurityToken); }
public static ContextualSecurityToken OTPGateChallengeResponse(WorkflowAuthenticationResponse gateResponse, ref AuthenticationRequiredException authNException, out WorkflowAuthenticationChallenge workflowAuthenticationChallenge) { AuthenticationChallengeResponseType[] authenticationChallengeResponses = null; if (gateResponse != null) { AuthenticationChallengeResponseType authenticationChallengeResponse = new AuthenticationChallengeResponseType(); authenticationChallengeResponse.Response = new ClientSerializer( typeof(WorkflowAuthenticationResponse)).WriteObjectToXmlElement(gateResponse); authenticationChallengeResponses = new AuthenticationChallengeResponseType[] { authenticationChallengeResponse }; } ContextualSecurityToken authNSecurityToken = null; workflowAuthenticationChallenge = null; try { MessageBuffer messageBuffer; authNSecurityToken = authNException.Authenticate(authenticationChallengeResponses, out messageBuffer); } catch (AuthenticationRequiredException exception) { authNException = exception; workflowAuthenticationChallenge = (WorkflowAuthenticationChallenge)new Microsoft.ResourceManagement.Client.ClientSerializer( typeof(WorkflowAuthenticationChallenge)).ReadObjectFromXmlNode( authNException.AuthenticationChallenges[0].Challenge); } return authNSecurityToken; }