aboutsummaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'plugins')
-rw-r--r--plugins/VNLib.Plugins.Essentials.Accounts.Admin/src/Endpoints/UsersEndpoint.cs2
-rw-r--r--plugins/VNLib.Plugins.Essentials.Accounts.Admin/src/Model/UserStore.cs44
-rw-r--r--plugins/VNLib.Plugins.Essentials.Accounts.Registration/src/Endpoints/RegistrationEntpoint.cs58
-rw-r--r--plugins/VNLib.Plugins.Essentials.Accounts.Registration/src/VNLib.Plugins.Essentials.Accounts.Registration.csproj3
-rw-r--r--plugins/VNLib.Plugins.Essentials.Accounts/src/Endpoints/PkiLoginEndpoint.cs3
-rw-r--r--plugins/VNLib.Plugins.Essentials.Accounts/src/MFA/FidoAuthenticatorSelection.cs2
-rw-r--r--plugins/VNLib.Plugins.Essentials.Accounts/src/VNLib.Plugins.Essentials.Accounts.csproj2
-rw-r--r--plugins/VNLib.Plugins.Essentials.Accounts/src/Validators/LoginMessageValidation.cs7
-rw-r--r--plugins/VNLib.Plugins.Essentials.Content.Routing/src/IRouteStore.cs3
-rw-r--r--plugins/VNLib.Plugins.Essentials.Content.Routing/src/ManagedRouteStore.cs7
-rw-r--r--plugins/VNLib.Plugins.Essentials.Content.Routing/src/Model/DbRouteStore.cs52
-rw-r--r--plugins/VNLib.Plugins.Essentials.Content.Routing/src/Model/Route.cs2
-rw-r--r--plugins/VNLib.Plugins.Essentials.Content.Routing/src/Model/RoutingContext.cs6
-rw-r--r--plugins/VNLib.Plugins.Essentials.Content.Routing/src/Model/XmlRouteStore.cs4
-rw-r--r--plugins/VNLib.Plugins.Essentials.Content.Routing/src/RouteComparer.cs6
-rw-r--r--plugins/VNLib.Plugins.Essentials.Content.Routing/src/Router.cs5
-rw-r--r--plugins/VNLib.Plugins.Essentials.SocialOauth/src/SocialOauthBase.cs22
17 files changed, 128 insertions, 100 deletions
diff --git a/plugins/VNLib.Plugins.Essentials.Accounts.Admin/src/Endpoints/UsersEndpoint.cs b/plugins/VNLib.Plugins.Essentials.Accounts.Admin/src/Endpoints/UsersEndpoint.cs
index dcd7799..5020e72 100644
--- a/plugins/VNLib.Plugins.Essentials.Accounts.Admin/src/Endpoints/UsersEndpoint.cs
+++ b/plugins/VNLib.Plugins.Essentials.Accounts.Admin/src/Endpoints/UsersEndpoint.cs
@@ -31,11 +31,11 @@ using VNLib.Utils;
using VNLib.Plugins.Essentials.Users;
using VNLib.Plugins.Essentials.Extensions;
using VNLib.Plugins.Essentials.Accounts.Admin.Model;
-using VNLib.Plugins.Extensions.Data;
using VNLib.Plugins.Extensions.Loading;
using VNLib.Plugins.Extensions.Loading.Sql;
using VNLib.Plugins.Extensions.Loading.Users;
using VNLib.Plugins.Essentials.Accounts.Admin.Helpers;
+using VNLib.Plugins.Extensions.Data.Extensions;
namespace VNLib.Plugins.Essentials.Accounts.Admin.Endpoints
{
diff --git a/plugins/VNLib.Plugins.Essentials.Accounts.Admin/src/Model/UserStore.cs b/plugins/VNLib.Plugins.Essentials.Accounts.Admin/src/Model/UserStore.cs
index 2f44108..82a4331 100644
--- a/plugins/VNLib.Plugins.Essentials.Accounts.Admin/src/Model/UserStore.cs
+++ b/plugins/VNLib.Plugins.Essentials.Accounts.Admin/src/Model/UserStore.cs
@@ -27,6 +27,7 @@ using System;
using Microsoft.EntityFrameworkCore;
using VNLib.Plugins.Extensions.Data;
+using VNLib.Plugins.Extensions.Data.Abstractions;
namespace VNLib.Plugins.Essentials.Accounts.Admin.Model
{
@@ -40,29 +41,38 @@ namespace VNLib.Plugins.Essentials.Accounts.Admin.Model
Options = options;
}
- //Item id's are not used
- public override string RecordIdBuilder => "";
- protected override IQueryable<User> GetCollectionQueryBuilder(TransactionalDbContext context, params string[] constraints)
- {
- return (from user in context.Set<User>()
- orderby user.Created descending
- select user);
- }
+ ///<inheritdoc/>
+ public override IDbContextHandle GetNewContext() => new UserContext(Options);
- protected override IQueryable<User> GetSingleQueryBuilder(TransactionalDbContext context, params string[] constraints)
- {
- string userId = constraints[0];
- return (from user in context.Set<User>()
- where user.UserId == userId
- select user);
- }
+ ///<inheritdoc/>
+ public override string GetNewRecordId() => string.Empty; //IDs are not created here
- public override TransactionalDbContext NewContext() => new UserContext(Options);
+ ///<inheritdoc/>
+ public override IDbQueryLookup<User> QueryTable { get; } = new DbQueries();
- protected override void OnRecordUpdate(User newRecord, User currentRecord)
+ ///<inheritdoc/>
+ public override void OnRecordUpdate(User newRecord, User currentRecord)
{
currentRecord.Privilages = currentRecord.Privilages;
}
+
+ private sealed class DbQueries : IDbQueryLookup<User>
+ {
+ public IQueryable<User> GetCollectionQueryBuilder(IDbContextHandle context, params string[] constraints)
+ {
+ return (from user in context.Set<User>()
+ orderby user.Created descending
+ select user);
+ }
+
+ public IQueryable<User> GetSingleQueryBuilder(IDbContextHandle context, params string[] constraints)
+ {
+ string userId = constraints[0];
+ return (from user in context.Set<User>()
+ where user.UserId == userId
+ select user);
+ }
+ }
}
}
diff --git a/plugins/VNLib.Plugins.Essentials.Accounts.Registration/src/Endpoints/RegistrationEntpoint.cs b/plugins/VNLib.Plugins.Essentials.Accounts.Registration/src/Endpoints/RegistrationEntpoint.cs
index c1f8589..6a81e7e 100644
--- a/plugins/VNLib.Plugins.Essentials.Accounts.Registration/src/Endpoints/RegistrationEntpoint.cs
+++ b/plugins/VNLib.Plugins.Essentials.Accounts.Registration/src/Endpoints/RegistrationEntpoint.cs
@@ -5,18 +5,18 @@
* Package: VNLib.Plugins.Essentials.Accounts.Registration
* File: RegistrationEntpoint.cs
*
-* RegistrationEntpoint.cs is part of VNLib.Plugins.Essentials.Accounts.Registration which is part of the larger
-* VNLib collection of libraries and utilities.
+* RegistrationEntpoint.cs is part of VNLib.Plugins.Essentials.Accounts.Registration
+* which is part of the larger VNLib collection of libraries and utilities.
*
-* VNLib.Plugins.Essentials.Accounts.Registration is free software: you can redistribute it and/or modify
-* it under the terms of the GNU Affero General Public License as
-* published by the Free Software Foundation, either version 3 of the
-* License, or (at your option) any later version.
+* VNLib.Plugins.Essentials.Accounts.Registration is free software: you can
+* redistribute it and/or modify it under the terms of the GNU Affero General
+* Public License as published by the Free Software Foundation, either version
+* 3 of the License, or (at your option) any later version.
*
-* VNLib.Plugins.Essentials.Accounts.Registration is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-* GNU Affero General Public License for more details.
+* VNLib.Plugins.Essentials.Accounts.Registration is distributed in the
+* hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+* the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+* PURPOSE. See the GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see https://www.gnu.org/licenses/.
@@ -29,6 +29,7 @@ using System.Text.Json;
using FluentValidation;
using Emails.Transactional.Client;
+using Emails.Transactional.Client.Plugins;
using Emails.Transactional.Client.Exceptions;
using VNLib.Hashing;
@@ -45,7 +46,6 @@ using VNLib.Plugins.Extensions.Loading.Sql;
using VNLib.Plugins.Extensions.Loading.Events;
using VNLib.Plugins.Extensions.Loading.Users;
using VNLib.Plugins.Extensions.Validation;
-using Emails.Transactional.Client.Extensions;
using VNLib.Plugins.Essentials.Accounts.Registration.TokenRevocation;
using static VNLib.Plugins.Essentials.Accounts.AccountUtil;
@@ -89,15 +89,16 @@ namespace VNLib.Plugins.Essentials.Accounts.Registration.Endpoints
RegJwtValdidator = GetJwtValidator();
Passwords = plugin.GetOrCreateSingleton<ManagedPasswordHashing>();
- Users = plugin.GetOrCreateSingleton<UserManager>();
- RevokedTokens = new(plugin.GetContextOptions());
+ Users = plugin.GetOrCreateSingleton<UserManager>();
Emails = plugin.GetOrCreateSingleton<TEmailConfig>();
+ RevokedTokens = new(plugin.GetContextOptions());
//Begin the async op to get the signature key from the vault
RegSignatureKey = plugin.GetSecretAsync("reg_sig_key")
.ToLazy(static sr => sr.GetJsonWebKey());
}
+
private static IValidator<string> GetJwtValidator()
{
InlineValidator<string> val = new();
@@ -111,7 +112,15 @@ namespace VNLib.Plugins.Essentials.Accounts.Registration.Endpoints
.IllegalCharacters();
return val;
}
-
+
+ //Schedule cleanup interval
+ [AsyncInterval(Minutes = 5)]
+ public async Task OnIntervalAsync(ILogProvider log, CancellationToken cancellationToken)
+ {
+ //Cleanup tokens
+ await RevokedTokens.CleanTableAsync(RegExpiresSec, cancellationToken);
+ }
+
protected override async ValueTask<VfReturnType> PostAsync(HttpEntity entity)
{
@@ -319,12 +328,13 @@ namespace VNLib.Plugins.Essentials.Accounts.Registration.Endpoints
{
//Get a new registration template
EmailTransactionRequest emailTemplate = Emails.GetTemplateRequest("Registration");
+
//Add the user's to address
- emailTemplate.AddToAddress(emailAddress);
- emailTemplate.AddVariable("username", emailAddress);
- //Set the security code variable string
- emailTemplate.AddVariable("reg_url", url);
- emailTemplate.AddVariable("date", current.ToString("f"));
+ emailTemplate.AddToAddress(emailAddress)
+ .AddVariable("username", emailAddress)
+ //Set the security code variable string
+ .AddVariable("reg_url", url)
+ .AddVariable("date", current.ToString("f"));
//Send the email
TransactionResult result = await Emails.SendEmailAsync(emailTemplate);
@@ -356,14 +366,6 @@ namespace VNLib.Plugins.Essentials.Accounts.Registration.Endpoints
Log.Error(ex);
}
}
-
-
- //Schedule cleanup interval 60 seconds
- [AsyncInterval(Minutes = 1)]
- public async Task OnIntervalAsync(ILogProvider log, CancellationToken cancellationToken)
- {
- //Cleanup tokens
- await RevokedTokens.CleanTableAsync(RegExpiresSec, cancellationToken);
- }
+
}
} \ No newline at end of file
diff --git a/plugins/VNLib.Plugins.Essentials.Accounts.Registration/src/VNLib.Plugins.Essentials.Accounts.Registration.csproj b/plugins/VNLib.Plugins.Essentials.Accounts.Registration/src/VNLib.Plugins.Essentials.Accounts.Registration.csproj
index ba91d90..d20457d 100644
--- a/plugins/VNLib.Plugins.Essentials.Accounts.Registration/src/VNLib.Plugins.Essentials.Accounts.Registration.csproj
+++ b/plugins/VNLib.Plugins.Essentials.Accounts.Registration/src/VNLib.Plugins.Essentials.Accounts.Registration.csproj
@@ -34,12 +34,11 @@
<Deterministic>False</Deterministic>
</PropertyGroup>
<ItemGroup>
- <PackageReference Include="FluentValidation" Version="11.6.0" />
+ <PackageReference Include="FluentValidation" Version="11.7.1" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\..\..\..\core\lib\Plugins.Essentials\src\VNLib.Plugins.Essentials.csproj" />
<ProjectReference Include="..\..\..\..\Emails.Transactional\lib\Emails.Transactional.Client\src\Emails.Transactional.Client.csproj" />
- <ProjectReference Include="..\..\..\..\Emails.Transactional\lib\Emails.Transactional.Extensions\src\Emails.Transactional.Client.Extensions.csproj" />
<ProjectReference Include="..\..\..\..\Extensions\lib\VNLib.Plugins.Extensions.Data\src\VNLib.Plugins.Extensions.Data.csproj" />
<ProjectReference Include="..\..\..\..\Extensions\lib\VNLib.Plugins.Extensions.Loading.Sql\src\VNLib.Plugins.Extensions.Loading.Sql.csproj" />
<ProjectReference Include="..\..\..\..\Extensions\lib\VNLib.Plugins.Extensions.Loading\src\VNLib.Plugins.Extensions.Loading.csproj" />
diff --git a/plugins/VNLib.Plugins.Essentials.Accounts/src/Endpoints/PkiLoginEndpoint.cs b/plugins/VNLib.Plugins.Essentials.Accounts/src/Endpoints/PkiLoginEndpoint.cs
index 48a3345..42c4ba6 100644
--- a/plugins/VNLib.Plugins.Essentials.Accounts/src/Endpoints/PkiLoginEndpoint.cs
+++ b/plugins/VNLib.Plugins.Essentials.Accounts/src/Endpoints/PkiLoginEndpoint.cs
@@ -428,7 +428,7 @@ namespace VNLib.Plugins.Essentials.Accounts.Endpoints
private sealed class JwtLoginValidator : ClientSecurityMessageValidator<JwtLoginMessage>
{
- public JwtLoginValidator() :base()
+ public JwtLoginValidator() : base()
{
//Basic jwt validator
RuleFor(l => l.LoginJwt)
@@ -492,7 +492,6 @@ namespace VNLib.Plugins.Essentials.Accounts.Endpoints
val.RuleFor(c => c.FailedCountTimeoutSec)
.GreaterThan(0);
-
return val;
}
diff --git a/plugins/VNLib.Plugins.Essentials.Accounts/src/MFA/FidoAuthenticatorSelection.cs b/plugins/VNLib.Plugins.Essentials.Accounts/src/MFA/FidoAuthenticatorSelection.cs
index 0ea6dad..6db41af 100644
--- a/plugins/VNLib.Plugins.Essentials.Accounts/src/MFA/FidoAuthenticatorSelection.cs
+++ b/plugins/VNLib.Plugins.Essentials.Accounts/src/MFA/FidoAuthenticatorSelection.cs
@@ -24,8 +24,6 @@
using System.Text.Json.Serialization;
-#nullable enable
-
namespace VNLib.Plugins.Essentials.Accounts.MFA
{
class FidoAuthenticatorSelection
diff --git a/plugins/VNLib.Plugins.Essentials.Accounts/src/VNLib.Plugins.Essentials.Accounts.csproj b/plugins/VNLib.Plugins.Essentials.Accounts/src/VNLib.Plugins.Essentials.Accounts.csproj
index 09423ed..c5dff6e 100644
--- a/plugins/VNLib.Plugins.Essentials.Accounts/src/VNLib.Plugins.Essentials.Accounts.csproj
+++ b/plugins/VNLib.Plugins.Essentials.Accounts/src/VNLib.Plugins.Essentials.Accounts.csproj
@@ -43,7 +43,7 @@
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
- <PackageReference Include="FluentValidation" Version="11.6.0" />
+ <PackageReference Include="FluentValidation" Version="11.7.1" />
</ItemGroup>
<ItemGroup>
diff --git a/plugins/VNLib.Plugins.Essentials.Accounts/src/Validators/LoginMessageValidation.cs b/plugins/VNLib.Plugins.Essentials.Accounts/src/Validators/LoginMessageValidation.cs
index 4cdf51b..4804480 100644
--- a/plugins/VNLib.Plugins.Essentials.Accounts/src/Validators/LoginMessageValidation.cs
+++ b/plugins/VNLib.Plugins.Essentials.Accounts/src/Validators/LoginMessageValidation.cs
@@ -65,11 +65,14 @@ namespace VNLib.Plugins.Essentials.Accounts.Validators
public ClientSecurityMessageValidator()
{
RuleFor(static t => t.ClientId)
- .Length(min: 10, max: 100)
- .WithMessage(errorMessage: "Your browser is not sending required security information");
+ .NotEmpty()
+ .WithMessage(errorMessage: "Your browser is not sending required security information")
+ .Length(min: 10, max: 100)
+ .WithMessage(errorMessage: "Your browser is not sending required security information");
RuleFor(static t => t.PublicKey)
.NotEmpty()
+ .WithMessage(errorMessage: "Your browser is not sending required security information")
.Length(min: 50, max: 1000)
.WithMessage(errorMessage: "Your browser is not sending required security information");
}
diff --git a/plugins/VNLib.Plugins.Essentials.Content.Routing/src/IRouteStore.cs b/plugins/VNLib.Plugins.Essentials.Content.Routing/src/IRouteStore.cs
index 39af773..d7ade6d 100644
--- a/plugins/VNLib.Plugins.Essentials.Content.Routing/src/IRouteStore.cs
+++ b/plugins/VNLib.Plugins.Essentials.Content.Routing/src/IRouteStore.cs
@@ -22,6 +22,7 @@
* along with this program. If not, see https://www.gnu.org/licenses/.
*/
+using System.Threading;
using System.Threading.Tasks;
using System.Collections.Generic;
@@ -36,6 +37,6 @@ namespace VNLib.Plugins.Essentials.Content.Routing
/// </summary>
/// <param name="routes">The collection to store loaded routes to</param>
/// <returns>A task that completes when the routes are added to the collection</returns>
- Task GetAllRoutesAsync(ICollection<Route> routes);
+ Task GetAllRoutesAsync(ICollection<Route> routes, CancellationToken cancellation);
}
}
diff --git a/plugins/VNLib.Plugins.Essentials.Content.Routing/src/ManagedRouteStore.cs b/plugins/VNLib.Plugins.Essentials.Content.Routing/src/ManagedRouteStore.cs
index d859551..e2b87a1 100644
--- a/plugins/VNLib.Plugins.Essentials.Content.Routing/src/ManagedRouteStore.cs
+++ b/plugins/VNLib.Plugins.Essentials.Content.Routing/src/ManagedRouteStore.cs
@@ -22,6 +22,7 @@
* along with this program. If not, see https://www.gnu.org/licenses/.
*/
+using System.Threading;
using System.Threading.Tasks;
using System.Collections.Generic;
@@ -50,13 +51,13 @@ namespace VNLib.Plugins.Essentials.Content.Routing
_routeStore = plugin.GetOrCreateSingleton<DbRouteStore>();
//Ensure the database is created
- _ = plugin.ObserveWork(() => plugin.EnsureDbCreatedAsync<RoutingContext>(plugin), 500);
+ _ = plugin.ObserveWork(() => plugin.EnsureDbCreatedAsync<RoutingContext>(plugin), 1000);
}
}
- public Task GetAllRoutesAsync(ICollection<Route> routes)
+ public Task GetAllRoutesAsync(ICollection<Route> routes, CancellationToken cancellation)
{
- return _routeStore.GetAllRoutesAsync(routes);
+ return _routeStore.GetAllRoutesAsync(routes, cancellation);
}
}
}
diff --git a/plugins/VNLib.Plugins.Essentials.Content.Routing/src/Model/DbRouteStore.cs b/plugins/VNLib.Plugins.Essentials.Content.Routing/src/Model/DbRouteStore.cs
index 0c2fca6..b90ee65 100644
--- a/plugins/VNLib.Plugins.Essentials.Content.Routing/src/Model/DbRouteStore.cs
+++ b/plugins/VNLib.Plugins.Essentials.Content.Routing/src/Model/DbRouteStore.cs
@@ -24,6 +24,7 @@
using System;
using System.Linq;
+using System.Threading;
using System.Collections.Generic;
using System.Threading.Tasks;
@@ -31,13 +32,17 @@ using Microsoft.EntityFrameworkCore;
using VNLib.Plugins.Extensions.Data;
using VNLib.Plugins.Extensions.Loading.Sql;
+using VNLib.Plugins.Extensions.Data.Abstractions;
+using VNLib.Plugins.Extensions.Data.Extensions;
namespace VNLib.Plugins.Essentials.Content.Routing.Model
{
- internal class DbRouteStore : DbStore<Route>, IRouteStore
+ internal sealed class DbRouteStore : DbStore<Route>, IRouteStore
{
private readonly DbContextOptions Options;
+ public override IDbQueryLookup<Route> QueryTable { get; } = new DbQueries();
+
public DbRouteStore(PluginBase plugin)
{
//Load the db context options
@@ -45,41 +50,42 @@ namespace VNLib.Plugins.Essentials.Content.Routing.Model
}
///<inheritdoc/>
- public Task GetAllRoutesAsync(ICollection<Route> routes)
+ public Task GetAllRoutesAsync(ICollection<Route> routes, CancellationToken cancellation)
{
//Get all routes as a single page from the database
- return GetPageAsync(routes, 0, int.MaxValue);
+ return this.GetPageAsync(routes, 0, int.MaxValue, cancellation);
}
///<inheritdoc/>
- public override string RecordIdBuilder => Guid.NewGuid().ToString("N");
+ public override string GetNewRecordId() => Guid.NewGuid().ToString("N");
///<inheritdoc/>
- protected override IQueryable<Route> GetCollectionQueryBuilder(TransactionalDbContext context, params string[] constraints)
- {
- string hostname = constraints[0];
- return from route in context.Set<Route>()
- where route.Hostname == hostname
- select route;
- }
+ public override IDbContextHandle GetNewContext() => new RoutingContext(Options);
///<inheritdoc/>
- protected override IQueryable<Route> GetSingleQueryBuilder(TransactionalDbContext context, params string[] constraints)
+ public override void OnRecordUpdate(Route newRecord, Route currentRecord)
{
- string id = constraints[0];
- return from route in context.Set<Route>()
- where route.Id == id
- select route;
+ throw new NotSupportedException();
}
- ///<inheritdoc/>
- public override TransactionalDbContext NewContext() => new RoutingContext(Options);
-
- ///<inheritdoc/>
- protected override void OnRecordUpdate(Route newRecord, Route currentRecord)
+ private sealed record class DbQueries : IDbQueryLookup<Route>
{
- throw new NotSupportedException();
- }
+ public IQueryable<Route> GetCollectionQueryBuilder(IDbContextHandle context, params string[] constraints)
+ {
+ string hostname = constraints[0];
+ return from route in context.Set<Route>()
+ where route.Hostname == hostname
+ select route;
+ }
+ public IQueryable<Route> GetSingleQueryBuilder(IDbContextHandle context, params string[] constraints)
+ {
+
+ string id = constraints[0];
+ return from route in context.Set<Route>()
+ where route.Id == id
+ select route;
+ }
+ }
}
}
diff --git a/plugins/VNLib.Plugins.Essentials.Content.Routing/src/Model/Route.cs b/plugins/VNLib.Plugins.Essentials.Content.Routing/src/Model/Route.cs
index 789d72f..ebd92ad 100644
--- a/plugins/VNLib.Plugins.Essentials.Content.Routing/src/Model/Route.cs
+++ b/plugins/VNLib.Plugins.Essentials.Content.Routing/src/Model/Route.cs
@@ -33,7 +33,7 @@ using VNLib.Plugins.Extensions.Data;
namespace VNLib.Plugins.Essentials.Content.Routing.Model
{
[Index(nameof(Id), IsUnique = true)]
- internal class Route : DbModelBase
+ internal sealed class Route : DbModelBase
{
public const FpRoutine RewriteRoutine = (FpRoutine)50;
diff --git a/plugins/VNLib.Plugins.Essentials.Content.Routing/src/Model/RoutingContext.cs b/plugins/VNLib.Plugins.Essentials.Content.Routing/src/Model/RoutingContext.cs
index 185b2f2..1a8d82a 100644
--- a/plugins/VNLib.Plugins.Essentials.Content.Routing/src/Model/RoutingContext.cs
+++ b/plugins/VNLib.Plugins.Essentials.Content.Routing/src/Model/RoutingContext.cs
@@ -31,7 +31,7 @@ using VNLib.Plugins.Extensions.Loading.Sql;
namespace VNLib.Plugins.Essentials.Content.Routing.Model
{
- internal class RoutingContext : TransactionalDbContext, IDbTableDefinition
+ internal sealed class RoutingContext : TransactionalDbContext, IDbTableDefinition
{
public DbSet<Route> Routes { get; set; }
@@ -41,8 +41,8 @@ namespace VNLib.Plugins.Essentials.Content.Routing.Model
{
}
- public RoutingContext()
- {}
+ public RoutingContext():base()
+ { }
#nullable enable
diff --git a/plugins/VNLib.Plugins.Essentials.Content.Routing/src/Model/XmlRouteStore.cs b/plugins/VNLib.Plugins.Essentials.Content.Routing/src/Model/XmlRouteStore.cs
index 2dcc25c..fce193e 100644
--- a/plugins/VNLib.Plugins.Essentials.Content.Routing/src/Model/XmlRouteStore.cs
+++ b/plugins/VNLib.Plugins.Essentials.Content.Routing/src/Model/XmlRouteStore.cs
@@ -57,7 +57,7 @@ namespace VNLib.Plugins.Essentials.Content.Routing.Model
}
///<inheritdoc/>
- public async Task GetAllRoutesAsync(ICollection<Route> routes)
+ public async Task GetAllRoutesAsync(ICollection<Route> routes, CancellationToken cancellation)
{
using VnMemoryStream memStream = new();
@@ -65,7 +65,7 @@ namespace VNLib.Plugins.Essentials.Content.Routing.Model
await using (FileStream routeFile = new(_routeFile, FileMode.Open, FileAccess.Read, FileShare.Read))
{
//Read the route file into memory
- await routeFile.CopyToAsync(memStream, 4096, MemoryUtil.Shared, CancellationToken.None);
+ await routeFile.CopyToAsync(memStream, 8192, MemoryUtil.Shared, cancellation);
}
//Rewind the memory stream
diff --git a/plugins/VNLib.Plugins.Essentials.Content.Routing/src/RouteComparer.cs b/plugins/VNLib.Plugins.Essentials.Content.Routing/src/RouteComparer.cs
index bd9f3b3..61e8303 100644
--- a/plugins/VNLib.Plugins.Essentials.Content.Routing/src/RouteComparer.cs
+++ b/plugins/VNLib.Plugins.Essentials.Content.Routing/src/RouteComparer.cs
@@ -1,5 +1,5 @@
/*
-* Copyright (c) 2022 Vaughn Nugent
+* Copyright (c) 2023 Vaughn Nugent
*
* Library: VNLib
* Package: VNLib.Plugins.Essentials.Content.Routing
@@ -33,10 +33,10 @@ namespace VNLib.Plugins.Essentials.Content.Routing
/// <summary>
/// Sorts routing rules based on closest match path/hostname routing along with privilage priority
/// </summary>
- internal class RouteComparer : IComparer<Route>
+ internal sealed class RouteComparer : IComparer<Route>
{
//The idea is that hostnames without wildcards are exact, and hostnames with wildcards are "catch all"
- public int Compare(Route x, Route y)
+ public int Compare(Route? x, Route? y)
{
int val = 0;
//If x contains a wildcard in the hostname, then it is less than y
diff --git a/plugins/VNLib.Plugins.Essentials.Content.Routing/src/Router.cs b/plugins/VNLib.Plugins.Essentials.Content.Routing/src/Router.cs
index 59a88c1..fda572a 100644
--- a/plugins/VNLib.Plugins.Essentials.Content.Routing/src/Router.cs
+++ b/plugins/VNLib.Plugins.Essentials.Content.Routing/src/Router.cs
@@ -25,6 +25,7 @@
using System;
using System.Linq;
using System.Buffers;
+using System.Threading;
using System.Threading.Tasks;
using System.Collections.Generic;
using System.Collections.Concurrent;
@@ -40,7 +41,7 @@ using VNLib.Plugins.Essentials.Content.Routing.Model;
namespace VNLib.Plugins.Essentials.Content.Routing
{
- internal class Router : IPageRouter
+ internal sealed class Router : IPageRouter
{
private static readonly RouteComparer Comparer = new();
@@ -92,7 +93,7 @@ namespace VNLib.Plugins.Essentials.Content.Routing
List<Route> collection = new();
//Load all routes from the backing store and filter them
- await Store.GetAllRoutesAsync(collection);
+ await Store.GetAllRoutesAsync(collection, CancellationToken.None);
Logger.Debug("Found {r} routes in store", collection.Count);
diff --git a/plugins/VNLib.Plugins.Essentials.SocialOauth/src/SocialOauthBase.cs b/plugins/VNLib.Plugins.Essentials.SocialOauth/src/SocialOauthBase.cs
index 38281d4..d053fc8 100644
--- a/plugins/VNLib.Plugins.Essentials.SocialOauth/src/SocialOauthBase.cs
+++ b/plugins/VNLib.Plugins.Essentials.SocialOauth/src/SocialOauthBase.cs
@@ -144,6 +144,10 @@ namespace VNLib.Plugins.Essentials.SocialOauth
.Length(50, 1024)
.WithMessage("Request is not valid");
+ val.RuleFor(static s => s.LocalLanguage)
+ .Length(2, 10)
+ .WithMessage("Request is not valid");
+
return val;
}
@@ -621,7 +625,7 @@ namespace VNLib.Plugins.Essentials.SocialOauth
using JsonWebToken jwt = new();
//Write claim body, we dont need a header
- jwt.WritePayload(claim);
+ jwt.WritePayload(claim, Statics.SR_OPTIONS);
//Generate signing key
byte[] sigKey = RandomHash.GetRandomBytes(SIGNING_KEY_SIZE);
@@ -743,12 +747,6 @@ namespace VNLib.Plugins.Essentials.SocialOauth
sealed class LoginClaim : IClientSecInfo
{
- [JsonPropertyName("public_key")]
- public string? PublicKey { get; set; }
-
- [JsonPropertyName("browser_id")]
- public string? ClientId { get; set; }
-
[JsonPropertyName("exp")]
public long ExpirationSeconds { get; set; }
@@ -757,6 +755,16 @@ namespace VNLib.Plugins.Essentials.SocialOauth
[JsonPropertyName("nonce")]
public string? Nonce { get; set; }
+
+ [JsonPropertyName("locallanguage")]
+ public string? LocalLanguage { get; set; }
+
+ [JsonPropertyName("pubkey")]
+ public string? PublicKey { get; set; }
+
+ [JsonPropertyName("clientid")]
+ public string? ClientId { get; set; }
+
public void ComputeNonce(int nonceSize)
{