private AuthorizeState GenerateRequestState(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);
            }
        }
        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.AsActionResultMvc5()
                };
            }
            catch (ProtocolException ex)
            {
                var result = new AuthorizeState(returnUrl, OpenAuthenticationStatus.Error);
                result.AddError("Unable to authenticate: " + ex.Message);
                return result;
            }
        }
 public IAuthenticationRequest CreateRequest(OpenIdIdentifier openIdIdentifier)
 {
     return _relyingParty.CreateRequest(openIdIdentifier.Identifier);
 }
Beispiel #4
0
 public IAuthenticationRequest CreateRequest(OpenIdIdentifier openIdIdentifier)
 {
     return(_relyingParty.CreateRequest(openIdIdentifier.Identifier));
 }