public AuthResult TryToApply()
        {
            AuthResult result = AuthResult.Failed();

            _requestData.Value(SamlResponseKey, v => {
                try
                {
                    var xml = v.RawValue as string;
                    ProcessSamlResponseXml(xml);
                }
                catch (Exception e)
                {
                    _logger.Error("Saml Response handling failed", e);
                    _director.FailedUser();
                }

                result = _director.Result();
            });

            return(result);
        }
 public void Handle(ISamlDirector director, SamlResponse response)
 {
     validate(response);
     if (response.Errors.Any())
     {
         _logger.InfoMessage(() => new SamlAuthenticationFailed(response));
         director.FailedUser(failedContinuation(response)); // just let it go to the login page
     }
     else
     {
         _logger.InfoMessage(() => new SamlAuthenticationSucceeded(response));
         var persistedUsername = createLocalUser(response);
         director.SuccessfulUser(persistedUsername, successfulContinuation(response));
     }
 }
 public void Handle(ISamlDirector director, SamlResponse response)
 {
     validate(response);
     if (response.Errors.Any())
     {
         _logger.InfoMessage(() => new SamlAuthenticationFailed(response));
         director.FailedUser(failedContinuation(response)); // just let it go to the login page
     }
     else
     {
         _logger.InfoMessage(() => new SamlAuthenticationSucceeded(response));
         var persistedUsername = createLocalUser(response);
         director.SuccessfulUser(persistedUsername, successfulContinuation(response));
     }
 }