Exemple #1
0
        public IAdapterPresentation TryEndAuthentication(IAuthenticationContext context, IProofData proofData, HttpListenerRequest request, out Claim[] outgoingClaims)
        {
            AdapterPresentation authResponse = null;
            string responseMessage           = null;

            outgoingClaims = new Claim[0];

            log.Debug("Authentication beginning for {0}", this.upn);

            bool isValidated = ValidateProofDataAsync(proofData, context, out responseMessage);

            log.Debug(responseMessage);

            if (!isValidated)
            {
                authResponse = new AdapterPresentation(responseMessage, false);
            }
            else
            {
                outgoingClaims = new[]
                {
                    new Claim(
                        "http://schemas.microsoft.com/ws/2008/06/identity/claims/authenticationmethod",
                        "http://schemas.microsoft.com/ws/2012/12/authmethod/otp"
                        )
                };
            }

            return(authResponse);
        }
Exemple #2
0
        public IAdapterPresentation TryEndAuthentication(IAuthenticationContext context, IProofData proofData, HttpListenerRequest request, out Claim[] outgoingClaims)
        {
            AdapterPresentation authResponse = null;
            string responseMessage           = null;

            outgoingClaims = new Claim[0];

            // retrieve context data stored earlier
            string userPrincipalName = (string)context.Data[USERUPN];

            log.Debug("[{0}] Authentication beginning for {1}", context.ActivityId, userPrincipalName);
            bool isValidated = ValidateProofDataAsync(proofData, context, out responseMessage);

            if (!isValidated)
            {
                log.Info("Authentication failed for {0} - {1}", userPrincipalName, responseMessage);
                authResponse = new AdapterPresentation(responseMessage, false);
            }
            else
            {
                log.Info("Authentication successful for {0}", userPrincipalName);

                outgoingClaims = new[]
                {
                    new Claim(
                        "http://schemas.microsoft.com/ws/2008/06/identity/claims/authenticationmethod",
                        "http://schemas.microsoft.com/ws/2012/12/authmethod/otp"
                        )
                };
            }

            return(authResponse);
        }