本文整理汇总了C#中Microsoft.Owin.Security.OAuth.OAuthValidateClientRedirectUriContext类的典型用法代码示例。如果您正苦于以下问题:C# OAuthValidateClientRedirectUriContext类的具体用法?C# OAuthValidateClientRedirectUriContext怎么用?C# OAuthValidateClientRedirectUriContext使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
OAuthValidateClientRedirectUriContext类属于Microsoft.Owin.Security.OAuth命名空间,在下文中一共展示了OAuthValidateClientRedirectUriContext类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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
示例16: 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
示例17: ValidateClientRedirectUri
public override Task ValidateClientRedirectUri(OAuthValidateClientRedirectUriContext context)
{
if (context.ClientId == this.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:johnsmith9264,项目名称:Mvc4Application1,代码行数:18,代码来源:ApplicationOAuthProvider.cs
示例18: 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
示例19: ValidateClientRedirectUri
public override Task ValidateClientRedirectUri(OAuthValidateClientRedirectUriContext context)
{
// TODO: REFACTOR > code identical to CORS, same clients
if (_registeredClients == null)
{
_registeredClients = new Collection<Uri>();
string[] domains = ConfigurationManager.AppSettings["CORS"].Split(';');
foreach (var domain in domains)
{
_registeredClients.Add(new Uri(domain));
}
}
var client = new Uri(context.RedirectUri);
if (context.ClientId == _publicClientId && _registeredClients.Any(o => o.IsBaseOf(client)))
{
context.Validated();
}
return Task.FromResult<object>(null);
}
开发者ID:robyvandamme,项目名称:angular.net,代码行数:19,代码来源:ApplicationOAuthProvider.cs
示例20: ValidateClientRedirectUri
public override Task ValidateClientRedirectUri(OAuthValidateClientRedirectUriContext context)
{
if (context.ClientId == _publicClientId)
{
//BEGIN MODIFIED BY JLC
/*
Uri expectedRootUri = new Uri(context.Request.Uri, "/");
if (expectedRootUri.AbsoluteUri == context.RedirectUri)
{
context.Validated();
}
**/
context.Validated();
//TODO: Is this still compliant with oAuth 2.0?????????????????
//END MODIFIED BY JLC
}
return Task.FromResult<object>(null);
}
开发者ID:491134648,项目名称:Phonegap-OWIN,代码行数:20,代码来源:ApplicationOAuthProvider.cs
注:本文中的Microsoft.Owin.Security.OAuth.OAuthValidateClientRedirectUriContext类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论