refactorisation : separation du code serveur d'authentification
This commit is contained in:
parent
f8eef31fb3
commit
b462350d72
57 changed files with 5452 additions and 108 deletions
40
OAuth.AspNet.AuthServer/DefaultBehavior.cs
Normal file
40
OAuth.AspNet.AuthServer/DefaultBehavior.cs
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
using System;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace OAuth.AspNet.AuthServer
|
||||
{
|
||||
|
||||
internal static class DefaultBehavior
|
||||
{
|
||||
internal static readonly Func<OAuthValidateAuthorizeRequestContext, Task> ValidateAuthorizeRequest = context =>
|
||||
{
|
||||
context.Validated();
|
||||
return Task.FromResult<object>(null);
|
||||
};
|
||||
|
||||
internal static readonly Func<OAuthValidateTokenRequestContext, Task> ValidateTokenRequest = context =>
|
||||
{
|
||||
context.Validated();
|
||||
return Task.FromResult<object>(null);
|
||||
};
|
||||
|
||||
internal static readonly Func<OAuthGrantAuthorizationCodeContext, Task> GrantAuthorizationCode = context =>
|
||||
{
|
||||
if (context.Ticket != null && context.Ticket.Principal != null && context.Ticket.Principal.Identity.IsAuthenticated)
|
||||
{
|
||||
context.Validated();
|
||||
}
|
||||
return Task.FromResult<object>(null);
|
||||
};
|
||||
|
||||
internal static readonly Func<OAuthGrantRefreshTokenContext, Task> GrantRefreshToken = context =>
|
||||
{
|
||||
if (context.Ticket != null && context.Ticket.Principal != null && context.Ticket.Principal.Identity.IsAuthenticated)
|
||||
{
|
||||
context.Validated();
|
||||
}
|
||||
return Task.FromResult<object>(null);
|
||||
};
|
||||
}
|
||||
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue