當前位置: 首頁>>代碼示例>>C#>>正文


C# OAuth.OAuthValidateClientRedirectUriContext類代碼示例

本文整理匯總了C#中Microsoft.Owin.Security.OAuth.OAuthValidateClientRedirectUriContext的典型用法代碼示例。如果您正苦於以下問題:C# OAuthValidateClientRedirectUriContext類的具體用法?C# OAuthValidateClientRedirectUriContext怎麽用?C# OAuthValidateClientRedirectUriContext使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


OAuthValidateClientRedirectUriContext類屬於Microsoft.Owin.Security.OAuth命名空間,在下文中一共展示了OAuthValidateClientRedirectUriContext類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: ValidateClientRedirectUri

        public override Task ValidateClientRedirectUri(OAuthValidateClientRedirectUriContext context)
        {
            if (context.ClientId == _publicClientId)
                context.Validated();  

            return Task.FromResult<object>(null);
        }
開發者ID:njmube,項目名稱:ECare.Skeleton.WebAPI,代碼行數:7,代碼來源:ApplicationOAuthProvider.cs

示例2: ValidateClientRedirectUri

        /// <summary>
        /// Called to validate that the context.ClientId is a registered "client_id", and that the context.RedirectUri a "redirect_uri"
        /// registered for that client. This only occurs when processing the Authorize endpoint. The application MUST implement this
        /// call, and it MUST validate both of those factors before calling context.Validated. If the context.Validated method is called
        /// with a given redirectUri parameter, then IsValidated will only become true if the incoming redirect URI matches the given redirect URI.
        /// If context.Validated is not called the request will not proceed further.
        /// </summary>
        /// <param name="context">The context of the event carries information in and results out.</param>
        /// <returns>Task to enable asynchronous execution</returns>
        public override async Task ValidateClientRedirectUri(OAuthValidateClientRedirectUriContext context)
        {
            this.options.Logger.DebugFormat("Validating client id and redirect uri");

            // Only proceed if client id and redirect uri is provided
            if (string.IsNullOrEmpty(context.ClientId) || string.IsNullOrEmpty(context.RedirectUri))
            {
                this.options.Logger.WarnFormat("Client id ({0}) or client secret ({1}) is invalid", context.ClientId, context.RedirectUri);

                return;
            }

            this.options.Logger.DebugFormat("Authenticating client '{0}' and redirect uri '{1}'", context.ClientId, context.RedirectUri);

            var client = await this.options.ClientManager.AuthenticateClientAsync(context.ClientId, context.RedirectUri);

            if (!client.Identity.IsAuthenticated)
            {
                context.Rejected();

                this.options.Logger.WarnFormat("Client '{0}' and redirect uri '{1}' was not authenticated", context.ClientId, context.RedirectUri);

                return;
            }

            this.options.Logger.DebugFormat("Client '{0}' and redirect uri '{1}' was successfully authenticated", context.ClientId, context.RedirectUri);

            context.OwinContext.GetOAuthContext().ClientId = context.ClientId;
            context.OwinContext.GetOAuthContext().RedirectUri = context.RedirectUri;

            context.Validated(context.RedirectUri);
        }
開發者ID:ericklombardo,項目名稱:Sentinel.OAuth,代碼行數:41,代碼來源:SentinelAuthorizationServerProvider.cs

示例3: ValidateClientRedirectUri

 private Task ValidateClientRedirectUri(OAuthValidateClientRedirectUriContext context)
 {
   
     if (context.ClientId == ClientId)
     {
         context.Validated();
     }
    
     return Task.FromResult(0);
 }
開發者ID:Kristinn-Stefansson,項目名稱:raml-dotnet-tools,代碼行數:10,代碼來源:Startup.cs

示例4: ValidateClientRedirectUri

        public override Task ValidateClientRedirectUri(OAuthValidateClientRedirectUriContext context)
        {
            if (context.ClientId != _publicClientId) return Task.FromResult<object>(null);

            var expectedRootUri = new Uri(context.Request.Uri, "/");

            if (expectedRootUri.AbsoluteUri == context.RedirectUri) context.Validated();

            return Task.FromResult<object>(null);
        }
開發者ID:josuecorrea,項目名稱:SPAAngularJS,代碼行數:10,代碼來源:ApplicationOAuthProvider.cs

示例5: ValidateClientRedirectUri

        public override Task ValidateClientRedirectUri(OAuthValidateClientRedirectUriContext context)
        {
            Uri uri;
            if (Uri.TryCreate(context.RedirectUri, UriKind.Absolute, out uri))
            {
                context.Validated();

                return Task.FromResult(0);
            }
            return base.ValidateClientRedirectUri(context);
        }
開發者ID:jayway,項目名稱:JayLabs.Owin.OAuthAuthorization,代碼行數:11,代碼來源:CustomOAuthProvider.cs

示例6: ValidateClientRedirectUri

        public override Task ValidateClientRedirectUri(OAuthValidateClientRedirectUriContext context)
        {
            if (context.ClientId == _publicClientId) {
                Uri expectedRootUri = new Uri(context.Request.Uri, "/externalLogin"); // modified by Stephen

                if (expectedRootUri.AbsoluteUri == context.RedirectUri) {
                    context.Validated();
                }
            }

            return Task.FromResult<object>(null);
        }
開發者ID:codercamps,項目名稱:FullStackNET,代碼行數:12,代碼來源:ApplicationOAuthProvider.cs

示例7: ValidateClientRedirectUri

        public override Task ValidateClientRedirectUri(OAuthValidateClientRedirectUriContext context)
        {
            if (context.ClientId != _publicClientId) return null;

            var expectedRootUri = new Uri(context.Request.Uri, "/");

            if (expectedRootUri.AbsoluteUri == context.RedirectUri)
            {
                context.Validated();
            }

            return null;
        }
開發者ID:thiagolunardi,項目名稱:IdentityIsolation,代碼行數:13,代碼來源:ApplicationOAuthProvider.cs

示例8: ValidateClientRedirectUri

        public override Task ValidateClientRedirectUri(OAuthValidateClientRedirectUriContext context)
        {
            if (context.ClientId == _publicClientId)
            {
                Uri expectedRootUri = FullRootUri(HttpContext.Current);

                if (expectedRootUri.AbsoluteUri == context.RedirectUri)
                {
                    context.Validated();
                }
            }

            return Task.FromResult<object>(null);
        }
開發者ID:hopecee,項目名稱:Dourrranndal451,代碼行數:14,代碼來源:ApplicationOAuthProvider.cs

示例9: ValidateClientRedirectUri

        public override Task ValidateClientRedirectUri(OAuthValidateClientRedirectUriContext context)
        {
            if (context.ClientId == _publicClientId)
            {
                Uri expectedRootUri = new Uri(context.Request.Uri, "/");

                if (true /*expectedRootUri.AbsoluteUri == context.RedirectUri*/)
                {
                    context.Validated();
                }
            }

            return Task.FromResult<object>(null);
        }
開發者ID:soracte,項目名稱:NBudget,代碼行數:14,代碼來源:ApplicationOAuthProvider.cs

示例10: ValidateClientRedirectUri

        public override Task ValidateClientRedirectUri(OAuthValidateClientRedirectUriContext context)
        {
            if (context.ClientId == "self")
            {
                var expectedRootUri = new Uri(context.Request.Uri, "/");

                if (expectedRootUri.AbsoluteUri == context.RedirectUri)
                {
                    context.Validated();
                }
            }

            return Task.FromResult(0);
        }
開發者ID:WadeOne,項目名稱:EasyTeach,代碼行數:14,代碼來源:ApplicationOAuthProvider.cs

示例11: ValidateClientRedirectUri

        public override Task ValidateClientRedirectUri(OAuthValidateClientRedirectUriContext context)
        {
            if (context.ClientId == publicClientId)
            {
                Uri expectedRootUri = new Uri(context.Request.Uri, "/" + this.externalAuthPageUrl);

                if (expectedRootUri.AbsoluteUri == context.RedirectUri)
                {
                    context.Validated();
                }
            }

            return Task.FromResult<object>(null);
        }
開發者ID:supperslonic,項目名稱:SupperSlonicWebSite,代碼行數:14,代碼來源:ApplicationOAuthProvider.cs

示例12: ValidateClientRedirectUri

        public override System.Threading.Tasks.Task ValidateClientRedirectUri(OAuthValidateClientRedirectUriContext context)
        {
            if (context.ClientId == _publicClientId)
            {
                Uri expectedRootUri = new Uri(context.Request.Uri, "/");

                if (expectedRootUri.AbsoluteUri == context.RedirectUri)
                {
                    context.Validated();
                }
            }

            return System.Threading.Tasks.Task.FromResult<object>(null);
        }
開發者ID:hrraydov,項目名稱:RayToDo,代碼行數:14,代碼來源:ApplicationOAuthProvider.cs

示例13: ValidateClientRedirectUri

        public override Task ValidateClientRedirectUri(OAuthValidateClientRedirectUriContext context)
        {
            if (context.ClientId == _publicClientId)
            {
                Uri expectedRootUri = new Uri(context.Request.Uri, "/");
                Uri redirectUri = new Uri(context.RedirectUri);

                if (expectedRootUri.Authority == redirectUri.Authority)
                {
                    context.Validated();
                }
            }

            return Task.FromResult<object>(null);
        }
開發者ID:QuinntyneBrown,項目名稱:Angular.Net.SecureStarter,代碼行數:15,代碼來源:ApplicationOAuthProvider.cs

示例14: ValidateClientRedirectUri

        public override Task ValidateClientRedirectUri(OAuthValidateClientRedirectUriContext context)
        {
            //if (context.ClientId == _publicClientId)
            //{
            //    Uri expectedRootUri = new Uri(context.Request.Uri, "/");

            //    if (expectedRootUri.AbsoluteUri == context.RedirectUri)
            //    {
            //        context.Validated();
            //    }
            //}
            if (context.ClientId == _publicClientId)
            {
                context.Validated();
            }
            return Task.FromResult<object>(null);
        }
開發者ID:ValdimarThor,項目名稱:DXDevExtremeWebAPI,代碼行數:17,代碼來源:ApplicationOAuthProvider.cs

示例15: ValidateClientRedirectUri

        public override Task ValidateClientRedirectUri(OAuthValidateClientRedirectUriContext context)
        {
            if (context.ClientId != _publicClientId)
            {
                return Task.FromResult(0);
            }

            Uri expectedRootUri = new Uri(context.Request.Uri, "/");
            string windowsStoreRedirectUri = ConfigurationManager.AppSettings["windowsStoreRedirectUri"];

            if (expectedRootUri.AbsoluteUri == context.RedirectUri ||
                (windowsStoreRedirectUri != null && new Uri(windowsStoreRedirectUri).AbsoluteUri == context.RedirectUri))
            {
                context.Validated();
            }

            return Task.FromResult(0);
        }
開發者ID:andreychizhov,項目名稱:microsoft-aspnet-samples,代碼行數:18,代碼來源:ApplicationOAuthProvider.cs


注:本文中的Microsoft.Owin.Security.OAuth.OAuthValidateClientRedirectUriContext類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。