-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathClientAuthenticationHandler.cs
More file actions
17 lines (15 loc) · 951 Bytes
/
ClientAuthenticationHandler.cs
File metadata and controls
17 lines (15 loc) · 951 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
namespace Vinder.Federation.Application.Handlers.Identity;
public sealed class ClientAuthenticationHandler(ITenantCollection tenantCollection, IUserCollection userCollection, ITokenCollection tokenCollection, ISecurityTokenService tokenService) :
IMessageHandler<ClientAuthenticationCredentials, Result<ClientAuthenticationResult>>
{
public async Task<Result<ClientAuthenticationResult>> HandleAsync(
ClientAuthenticationCredentials parameters, CancellationToken cancellation = default)
{
IAuthorizationFlowHandler handler = parameters.GrantType switch
{
SupportedGrantType.AuthorizationCode => new AuthorizationCodeGrantHandler(tenantCollection, userCollection, tokenService, tokenCollection),
SupportedGrantType.ClientCredentials => new ClientCredentialsGrantHandler(tenantCollection, tokenService),
};
return await handler.HandleAsync(parameters, cancellation);
}
}