diff options
author | vnugent <public@vaughnnugent.com> | 2024-03-10 16:14:08 -0400 |
---|---|---|
committer | vnugent <public@vaughnnugent.com> | 2024-03-10 16:14:08 -0400 |
commit | 7088c48dd2014364d6b24891b913ff798132e97a (patch) | |
tree | f0fccf52d447206a96167bef65e8c93d7d68a6fd /libs/VNLib.Plugins.Sessions.OAuth/src/Endpoints | |
parent | 3e2adf39ac884af8e2bd3c94e0a1ce3e08dd113a (diff) |
Squashed commit of the following:
commit 720136fef00095c808f9d5c75449e3fd03e82ca0
Author: vnugent <public@vaughnnugent.com>
Date: Wed Mar 6 21:33:12 2024 -0500
chore: Took a look around
commit 71d6fb8c038adafa4a3a943cb0218cd234ef01ae
Author: vnugent <public@vaughnnugent.com>
Date: Mon Feb 12 20:12:28 2024 -0500
refactor: update to latest sql changes and remove untested oauth feature
commit 6941b12b44ccb1c184d9b6e33fbe19c72a0b3428
Author: vnugent <public@vaughnnugent.com>
Date: Sun Feb 4 01:30:26 2024 -0500
submit pending changes
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); } |