Пример #1
0
        private AuthorizeState RequestAuthentication(string returnUrl)
        {
            var identifier = new OpenIdIdentifier(EnternalIdentifier);
            if (!identifier.IsValid)
            {
                var result = new AuthorizeState(returnUrl, OpenAuthenticationStatus.Error);
                result.AddError("Invalid Open ID identifier");
                return result;
            }

            try
            {
                var request = _openIdRelyingPartyService.CreateRequest(identifier);

                request.AddExtension(Claims.CreateClaimsRequest());
                request.AddExtension(Claims.CreateFetchRequest());

                return new AuthorizeState(returnUrl, OpenAuthenticationStatus.RequiresRedirect)
                {
                    Result = request.RedirectingResponse.AsActionResult()
                };
            }
            catch (ProtocolException ex)
            {
                var result = new AuthorizeState(returnUrl, OpenAuthenticationStatus.Error);
                result.AddError("Unable to authenticate: " + ex.Message);
                return result;
            }
        }
Пример #2
0
        private AuthorizeState RequestAuthentication(string returnUrl)
        {
            var identifier = new OpenIdIdentifier(EnternalIdentifier);

            if (!identifier.IsValid)
            {
                var result = new AuthorizeState(returnUrl, OpenAuthenticationStatus.Error);
                result.AddError("Invalid Open ID identifier");
                return(result);
            }

            try
            {
                var request = _openIdRelyingPartyService.CreateRequest(identifier);

                request.AddExtension(Claims.CreateClaimsRequest());
                request.AddExtension(Claims.CreateFetchRequest());

                return(new AuthorizeState(returnUrl, OpenAuthenticationStatus.RequiresRedirect)
                {
                    Result = request.RedirectingResponse.AsActionResult()
                });
            }
            catch (ProtocolException ex)
            {
                var result = new AuthorizeState(returnUrl, OpenAuthenticationStatus.Error);
                result.AddError("Unable to authenticate: " + ex.Message);
                return(result);
            }
        }
Пример #3
0
 public IAuthenticationRequest CreateRequest(OpenIdIdentifier openIdIdentifier)
 {
     return(_relyingParty.CreateRequest(openIdIdentifier.Identifier));
 }
Пример #4
0
 public IAuthenticationRequest CreateRequest(OpenIdIdentifier openIdIdentifier)
 {
     return _relyingParty.CreateRequest(openIdIdentifier.Identifier);
 }