コード例 #1
0
        private async Task <bool> InvokeReturnPath()
        {
            Logger.WriteVerbose("InvokeReturnPath");

            var authenticationTicket = await Authenticate();

            var returnEndpointContext = new OAuth2ReturnEndpointContext(
                Request.Environment,
                authenticationTicket,
                ErrorDetails)
            {
                SignInAsAuthenticationType = Options.SignInAsAuthenticationType,
                RedirectUri = authenticationTicket.Extra.RedirectUrl
            };

            authenticationTicket.Extra.RedirectUrl = null;

            await Options.Provider.ReturnEndpoint(returnEndpointContext);

            if (returnEndpointContext.SignInAsAuthenticationType != null &&
                returnEndpointContext.Identity != null)
            {
                var identity = returnEndpointContext.Identity;

                if (!string.Equals(
                        identity.AuthenticationType,
                        returnEndpointContext.SignInAsAuthenticationType,
                        StringComparison.Ordinal))
                {
                    identity = new ClaimsIdentity(
                        identity.Claims,
                        returnEndpointContext.SignInAsAuthenticationType,
                        identity.NameClaimType,
                        identity.RoleClaimType);
                }

                Response.Grant(identity, returnEndpointContext.Extra);
            }

            if (!returnEndpointContext.IsRequestCompleted &&
                returnEndpointContext.RedirectUri != null)
            {
                Response.Redirect(returnEndpointContext.RedirectUri);
                returnEndpointContext.RequestCompleted();
            }

            var isRequestCompleted = returnEndpointContext.IsRequestCompleted;

            return(isRequestCompleted);
        }
 public virtual Task ReturnEndpoint(OAuth2ReturnEndpointContext context)
 {
     return OnReturnEndpoint(context);
 }
コード例 #3
0
 public virtual Task ReturnEndpoint(OAuth2ReturnEndpointContext context)
 {
     return(OnReturnEndpoint(context));
 }