diff options
Diffstat (limited to 'libs/VNLib.Plugins.Sessions.OAuth/src/Endpoints')
-rw-r--r-- | libs/VNLib.Plugins.Sessions.OAuth/src/Endpoints/AccessTokenEndpoint.cs | 10 | ||||
-rw-r--r-- | libs/VNLib.Plugins.Sessions.OAuth/src/Endpoints/RevocationEndpoint.cs | 4 |
2 files changed, 7 insertions, 7 deletions
diff --git a/libs/VNLib.Plugins.Sessions.OAuth/src/Endpoints/AccessTokenEndpoint.cs b/libs/VNLib.Plugins.Sessions.OAuth/src/Endpoints/AccessTokenEndpoint.cs index b73a7eb..ef5ff5c 100644 --- a/libs/VNLib.Plugins.Sessions.OAuth/src/Endpoints/AccessTokenEndpoint.cs +++ b/libs/VNLib.Plugins.Sessions.OAuth/src/Endpoints/AccessTokenEndpoint.cs @@ -58,7 +58,7 @@ namespace VNLib.Plugins.Sessions.OAuth.Endpoints public AccessTokenEndpoint(PluginBase pbase, IConfigScope config, IApplicationTokenFactory tokenFactory) { - string? path = config["token_path"].GetString();; + string? path = config.GetRequiredProperty("token_path", p => p.GetString()!); InitPathAndLog(path, pbase.Log); @@ -111,14 +111,14 @@ namespace VNLib.Plugins.Sessions.OAuth.Endpoints } } - entity.CloseResponseError(HttpStatusCode.BadRequest, ErrorType.InvalidClient, "Invalid grant type"); //Default to bad request + entity.CloseResponseError(HttpStatusCode.BadRequest, ErrorType.InvalidClient, "Invalid grant type"); return VfReturnType.VirtualSkip; } private async Task<VfReturnType> GenerateTokenAsync(HttpEntity entity, UserApplication? app) { - if (app == null) + if (app is null) { //App was not found or the credentials do not match entity.CloseResponseError(HttpStatusCode.UnprocessableEntity, ErrorType.InvalidClient, "The credentials are invalid or do not exist"); @@ -127,9 +127,9 @@ namespace VNLib.Plugins.Sessions.OAuth.Endpoints IOAuth2TokenResult? result = await TokenFactory.CreateAccessTokenAsync(entity, app, entity.EventCancellation); - if (result == null) + if (result is null) { - entity.CloseResponseError(HttpStatusCode.TooManyRequests, ErrorType.TemporarilyUnabavailable, "You have reached the maximum number of valid tokens for this application"); + entity.CloseResponseError(HttpStatusCode.TooManyRequests, ErrorType.TemporarilyUnavailable, "You have reached the maximum number of valid tokens for this application"); return VfReturnType.VirtualSkip; } diff --git a/libs/VNLib.Plugins.Sessions.OAuth/src/Endpoints/RevocationEndpoint.cs b/libs/VNLib.Plugins.Sessions.OAuth/src/Endpoints/RevocationEndpoint.cs index bdb4e4e..d21761c 100644 --- a/libs/VNLib.Plugins.Sessions.OAuth/src/Endpoints/RevocationEndpoint.cs +++ b/libs/VNLib.Plugins.Sessions.OAuth/src/Endpoints/RevocationEndpoint.cs @@ -1,5 +1,5 @@ /* -* Copyright (c) 2023 Vaughn Nugent +* Copyright (c) 2024 Vaughn Nugent * * Library: VNLib * Package: VNLib.Plugins.Essentials.Sessions.OAuth @@ -38,7 +38,7 @@ namespace VNLib.Plugins.Sessions.OAuth.Endpoints public RevocationEndpoint(PluginBase pbase, IConfigScope config) { - string? path = config["path"].GetString(); + string? path = config.GetRequiredProperty("path", p => p.GetString()!); InitPathAndLog(path, pbase.Log); } |