当前位置: 首页>>代码示例>>C#>>正文


C# OAuthValidateClientRedirectUriContext.Validated方法代码示例

本文整理汇总了C#中Microsoft.Owin.Security.OAuth.OAuthValidateClientRedirectUriContext.Validated方法的典型用法代码示例。如果您正苦于以下问题:C# OAuthValidateClientRedirectUriContext.Validated方法的具体用法?C# OAuthValidateClientRedirectUriContext.Validated怎么用?C# OAuthValidateClientRedirectUriContext.Validated使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Microsoft.Owin.Security.OAuth.OAuthValidateClientRedirectUriContext的用法示例。


在下文中一共展示了OAuthValidateClientRedirectUriContext.Validated方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ValidateClientRedirectUri

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

				if ( expectedRootUri.AbsoluteUri == context.RedirectUri ) {
					context.Validated();
				} else if ( context.ClientId == "web" ) {
					var expectedUri = new Uri( context.Request.Uri , "/" );
					context.Validated( expectedUri.AbsoluteUri );
				}
			}

			return Task.FromResult<object>( null );
		}
开发者ID:theuntitled,项目名称:JF.Cloudmarks,代码行数:14,代码来源:ApplicationOAuthProvider.cs

示例2: 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

示例3: ValidateClientRedirectUri

        public override Task ValidateClientRedirectUri(OAuthValidateClientRedirectUriContext context) {
            if (!String.IsNullOrEmpty(context.ClientId) && context.ClientId != PublicClientId) {
                var app = _applicationRepository.GetById(context.ClientId, true);
                if (app == null)
                    return Task.FromResult(0);

                if (!context.Request.Uri.AbsoluteUri.StartsWith(app.Url))
                    return Task.FromResult(0);

                context.Validated(context.Request.Uri.AbsoluteUri);
            } else {
                if (!context.Request.Uri.AbsoluteUri.StartsWith(context.Request.Uri.Authority))
                    return Task.FromResult(0);

                context.Validated(context.Request.Uri.AbsoluteUri);
            }

            return Task.FromResult(0);
        }
开发者ID:arpitgold,项目名称:Exceptionless,代码行数:19,代码来源:ExceptionlessOAuthAuthorizationServerProvider.cs

示例4: ValidateClientRedirectUri

		public override Task ValidateClientRedirectUri(OAuthValidateClientRedirectUriContext context)
		{
			if(context.ClientId == PublicClientId)
			{
				var expectedRootUri = new Uri(context.Request.Uri, "/");
				if(context.RedirectUri.StartsWith(expectedRootUri.AbsoluteUri))
					context.Validated();
			}

			return Task.FromResult<object>(null);
		}
开发者ID:Jaecen,项目名称:Peregrine,代码行数:11,代码来源: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)
            {
                var httpRequest = ((System.Web.HttpContextBase)context.OwinContext.Environment["System.Web.HttpContextBase"]).Request;
                var path = string.Format("{0}/", httpRequest.ApplicationPath.TrimEnd('/'));

                Uri expectedRootUri = new Uri(context.Request.Uri, path);

                if (expectedRootUri.AbsoluteUri == context.RedirectUri)
                {
                    context.Validated();
                }
                else if (context.ClientId == "web")
                {
                    var expectedUri = new Uri(context.Request.Uri, path);
                    context.Validated(expectedUri.AbsoluteUri);
                }
            }

            return Task.FromResult<object>(null);
        }
开发者ID:Hem,项目名称:OWIN-MixedAuth,代码行数:22,代码来源:ApplicationOAuthProvider.cs

示例9: ValidateClientRedirectUri

        public override Task ValidateClientRedirectUri(OAuthValidateClientRedirectUriContext context)
        {
            if (context.ClientId != this.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:AlexeyVoroshak,项目名称:ASP.NET-MVC-5-Tasks-List,代码行数:13,代码来源:ApplicationOAuthProvider.cs

示例10: 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

示例11: 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();
                //}
            }

            return Task.FromResult<object>(null);
        }
开发者ID:nyghtrocker,项目名称:Blog,代码行数:14,代码来源:ApplicationOAuthProvider.cs

示例12: 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

示例13: 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

示例14: ValidateClientRedirectUri

        public override Task ValidateClientRedirectUri(OAuthValidateClientRedirectUriContext context)
        {
            var authCookie = context.Request.Cookies[FormsAuthentication.FormsCookieName];
            var authTicket = FormsAuthentication.Decrypt(authCookie);

            if (authTicket.Expired)
                context.Rejected();
            else
                context.Validated();

            //We validated that Client Id and Reditect Uri are indeed what we expect
            //if (context.ClientId == "123456" && context.RedirectUri.Contains("localhost"))
            //    context.Validated();
            //else
            //    context.Rejected();

            return Task.FromResult<object>(null);
        }
开发者ID:codenewa,项目名称:CookieToToken,代码行数:18,代码来源:CIRImplicitAuthorizationServerProvider.cs

示例15: 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


注:本文中的Microsoft.Owin.Security.OAuth.OAuthValidateClientRedirectUriContext.Validated方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。