aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLibravatar vnugent <public@vaughnnugent.com>2024-01-02 02:33:18 -0500
committerLibravatar vnugent <public@vaughnnugent.com>2024-01-02 02:33:18 -0500
commite86fa273f2093089bec6379b6fa6b48625588a40 (patch)
treedb03cbc9d402277f37350062c3a50f75affd0913
parent0ca26fc63cc5311298575209b124516139f58206 (diff)
breaking changes: plugin service pools & move plugin api away from web related
-rw-r--r--lib/vnlib.browser/package.json2
-rw-r--r--plugins/VNLib.Plugins.Essentials.Accounts/src/AccountsEntryPoint.cs27
-rw-r--r--plugins/VNLib.Plugins.Essentials.Accounts/src/SecurityProvider/AccountSecProvider.cs7
-rw-r--r--plugins/VNLib.Plugins.Essentials.Content.Routing/src/PageRouterEntry.cs20
4 files changed, 19 insertions, 37 deletions
diff --git a/lib/vnlib.browser/package.json b/lib/vnlib.browser/package.json
index d4b2864..1c63ba1 100644
--- a/lib/vnlib.browser/package.json
+++ b/lib/vnlib.browser/package.json
@@ -3,7 +3,7 @@
"version": "0.1.13",
"author": "Vaughn Nugent",
"description": "Client JavaScript helper library for vuejs3 web-apps for connecting with Essentials.Accounts plugin and vuejs helpers.",
- "repository":"https://github.com/VnUgE/vnlib.browser",
+ "repository":"https://github.com/VnUgE/Plugins.Essentials/tree/master/lib/vnlib.browser",
"copyright":"Copyright \u00A9 2023 Vaughn Nugent",
"type": "module",
"main": "./dist/index.js",
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");
}
}