diff options
Diffstat (limited to 'plugins')
3 files changed, 18 insertions, 36 deletions
diff --git a/plugins/VNLib.Plugins.Essentials.Accounts/src/AccountsEntryPoint.cs b/plugins/VNLib.Plugins.Essentials.Accounts/src/AccountsEntryPoint.cs index d875def..835718e 100644 --- a/plugins/VNLib.Plugins.Essentials.Accounts/src/AccountsEntryPoint.cs +++ b/plugins/VNLib.Plugins.Essentials.Accounts/src/AccountsEntryPoint.cs @@ -1,5 +1,5 @@ /* -* Copyright (c) 2023 Vaughn Nugent +* Copyright (c) 2024 Vaughn Nugent * * Library: VNLib * Package: VNLib.Plugins.Essentials.Accounts @@ -24,14 +24,12 @@ using System; using System.Text.Json; -using System.ComponentModel.Design; using FluentValidation.Results; using VNLib.Utils; using VNLib.Utils.Memory; using VNLib.Utils.Logging; -using VNLib.Plugins.Attributes; using VNLib.Plugins.Essentials.Users; using VNLib.Plugins.Essentials.Middleware; using VNLib.Plugins.Essentials.Accounts.MFA; @@ -51,21 +49,6 @@ namespace VNLib.Plugins.Essentials.Accounts private bool SetupMode => HostArgs.HasArgument("--account-setup"); - private AccountSecProvider? _securityProvider; - - [ServiceConfigurator] - public void ConfigureServices(IServiceContainer services) - { - //Export the built in security provider and add it as a middleware item as well - if (_securityProvider != null) - { - services.AddService(typeof(IAccountSecurityProvider), _securityProvider); - - //Export as middleware - services.AddService(typeof(IHttpMiddleware[]), new IHttpMiddleware[] { _securityProvider }); - } - } - protected override void OnLoad() { //Add optional endpoint routing @@ -104,8 +87,12 @@ namespace VNLib.Plugins.Essentials.Accounts //Only export the account security service if the configuration element is defined if (this.HasConfigForType<AccountSecProvider>()) { - //Inint the security provider - _securityProvider = this.GetOrCreateSingleton<AccountSecProvider>(); + //Inint the security provider and export it + AccountSecProvider securityProvider = this.GetOrCreateSingleton<AccountSecProvider>(); + this.ExportService<IAccountSecurityProvider>(securityProvider); + + //Also add the middleware array + this.ExportService(new IHttpMiddleware[] { securityProvider }); Log.Information("Configuring the account security provider service"); } diff --git a/plugins/VNLib.Plugins.Essentials.Accounts/src/SecurityProvider/AccountSecProvider.cs b/plugins/VNLib.Plugins.Essentials.Accounts/src/SecurityProvider/AccountSecProvider.cs index 0d1a714..5a0e79d 100644 --- a/plugins/VNLib.Plugins.Essentials.Accounts/src/SecurityProvider/AccountSecProvider.cs +++ b/plugins/VNLib.Plugins.Essentials.Accounts/src/SecurityProvider/AccountSecProvider.cs @@ -1,5 +1,5 @@ /* -* Copyright (c) 2023 Vaughn Nugent +* Copyright (c) 2024 Vaughn Nugent * * Library: VNLib * Package: VNLib.Plugins.Essentials.Accounts @@ -316,7 +316,7 @@ namespace VNLib.Plugins.Essentials.Accounts.SecurityProvider finally { //Zero buffer when complete - MemoryUtil.InitializeBlock(buffer.Span); + MemoryUtil.InitializeBlock(ref buffer.GetReference(), buffer.GetIntLength()); } } @@ -573,6 +573,9 @@ namespace VNLib.Plugins.Essentials.Accounts.SecurityProvider return false; } + //Erase the signing key bytes + MemoryUtil.InitializeBlock(signingKey); + //Verify expiration using JsonDocument payload = jwt.GetPayload(); diff --git a/plugins/VNLib.Plugins.Essentials.Content.Routing/src/PageRouterEntry.cs b/plugins/VNLib.Plugins.Essentials.Content.Routing/src/PageRouterEntry.cs index 8370806..da254e2 100644 --- a/plugins/VNLib.Plugins.Essentials.Content.Routing/src/PageRouterEntry.cs +++ b/plugins/VNLib.Plugins.Essentials.Content.Routing/src/PageRouterEntry.cs @@ -1,5 +1,5 @@ /* -* Copyright (c) 2023 Vaughn Nugent +* Copyright (c) 2024 Vaughn Nugent * * Library: VNLib * Package: VNLib.Plugins.Essentials.Content.Routing @@ -23,10 +23,8 @@ */ using System; -using System.ComponentModel.Design; using VNLib.Utils.Logging; -using VNLib.Plugins.Attributes; using VNLib.Plugins.Extensions.Loading; namespace VNLib.Plugins.Essentials.Content.Routing @@ -35,19 +33,13 @@ namespace VNLib.Plugins.Essentials.Content.Routing { public override string PluginName => "Essentials.Router"; - private Router PageRouter; - - [ServiceConfigurator] - public void ConfigureServices(IServiceContainer services) - { - //Deploy the page router to the host - services.AddService<IPageRouter>(PageRouter); - } + private Router Router; protected override void OnLoad() { - //Init router - PageRouter = this.GetOrCreateSingleton<Router>(); + //Init router and export it as a service + Router = this.GetOrCreateSingleton<Router>(); + this.ExportService<IPageRouter>(Router); Log.Information("Plugin loaded"); } @@ -61,7 +53,7 @@ namespace VNLib.Plugins.Essentials.Content.Routing { if(cmd.Contains("reset", StringComparison.OrdinalIgnoreCase)) { - PageRouter?.ResetRoutes(); + Router?.ResetRoutes(); Log.Information("Routing table reset"); } } |