本文整理汇总了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 );
}
示例2: ValidateClientRedirectUri
public override Task ValidateClientRedirectUri(OAuthValidateClientRedirectUriContext context)
{
if (context.ClientId == _publicClientId)
context.Validated();
return Task.FromResult<object>(null);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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;
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}