aboutsummaryrefslogtreecommitdiff
path: root/plugins/VNLib.Plugins.Essentials.Accounts/src
diff options
context:
space:
mode:
authorLibravatar vnugent <public@vaughnnugent.com>2023-08-01 18:39:13 -0400
committerLibravatar vnugent <public@vaughnnugent.com>2023-08-01 18:39:13 -0400
commit22370f08ca900b60875778cd04978a67ae57faac (patch)
treef6bb4b29edef15fe1a2a1835918940e8fc9d20bb /plugins/VNLib.Plugins.Essentials.Accounts/src
parente1c1c679abdf482733ba601ee54f01bdfa79ddda (diff)
Latest updates, build configurations, and native compression
Diffstat (limited to 'plugins/VNLib.Plugins.Essentials.Accounts/src')
-rw-r--r--plugins/VNLib.Plugins.Essentials.Accounts/src/Endpoints/LoginEndpoint.cs7
-rw-r--r--plugins/VNLib.Plugins.Essentials.Accounts/src/MFA/UserMFAExtensions.cs15
-rw-r--r--plugins/VNLib.Plugins.Essentials.Accounts/src/VNLib.Plugins.Essentials.Accounts.csproj2
3 files changed, 14 insertions, 10 deletions
diff --git a/plugins/VNLib.Plugins.Essentials.Accounts/src/Endpoints/LoginEndpoint.cs b/plugins/VNLib.Plugins.Essentials.Accounts/src/Endpoints/LoginEndpoint.cs
index 5b50cb2..0d10811 100644
--- a/plugins/VNLib.Plugins.Essentials.Accounts/src/Endpoints/LoginEndpoint.cs
+++ b/plugins/VNLib.Plugins.Essentials.Accounts/src/Endpoints/LoginEndpoint.cs
@@ -361,13 +361,8 @@ namespace VNLib.Plugins.Essentials.Accounts.Endpoints
//Valid, complete
}
break;
- case MFAType.PGP:
- { }
- break;
default:
- {
- webm.Result = MFA_ERROR_MESSAGE;
- }
+ webm.Result = MFA_ERROR_MESSAGE;
return;
}
diff --git a/plugins/VNLib.Plugins.Essentials.Accounts/src/MFA/UserMFAExtensions.cs b/plugins/VNLib.Plugins.Essentials.Accounts/src/MFA/UserMFAExtensions.cs
index e042799..0b52f54 100644
--- a/plugins/VNLib.Plugins.Essentials.Accounts/src/MFA/UserMFAExtensions.cs
+++ b/plugins/VNLib.Plugins.Essentials.Accounts/src/MFA/UserMFAExtensions.cs
@@ -120,7 +120,10 @@ namespace VNLib.Plugins.Essentials.Accounts.MFA
using UnsafeMemoryHandle<byte> buffer = MemoryUtil.UnsafeAlloc(base32Secret.Length, true);
ERRNO count = VnEncoding.TryFromBase32Chars(base32Secret, buffer);
//Verify the TOTP using the decrypted secret
- return count && VerifyTOTP(code, buffer.AsSpan(0, count), config.TOTPConfig);
+ bool isValid = count && VerifyTOTP(code, buffer.AsSpan(0, count), config.TOTPConfig);
+ //Zero out the buffer
+ MemoryUtil.InitializeBlock(buffer.Span);
+ return isValid;
}
private static bool VerifyTOTP(uint totpCode, ReadOnlySpan<byte> userSecret, TOTPConfig config)
@@ -227,6 +230,12 @@ namespace VNLib.Plugins.Essentials.Accounts.MFA
public static void PKISetUserKey(this IUser user, IReadOnlyDictionary<string, string>? keyFields)
{
+ if(keyFields == null)
+ {
+ user[USER_PKI_ENTRY] = null!;
+ return;
+ }
+
//Serialize the key data
byte[] keyData = JsonSerializer.SerializeToUtf8Bytes(keyFields, Statics.SR_OPTIONS);
@@ -294,7 +303,7 @@ namespace VNLib.Plugins.Essentials.Accounts.MFA
/// <param name="upgradeJwtString">The signed JWT upgrade message</param>
/// <param name="base32Secret">The stored base64 encoded signature from the session that requested an upgrade</param>
/// <returns>True if the upgrade was verified, not expired, and was recovered from the signed message, false otherwise</returns>
- public static MFAUpgrade? RecoverUpgrade(this MFAConfig config, string upgradeJwtString, string base32Secret)
+ internal static MFAUpgrade? RecoverUpgrade(this MFAConfig config, string upgradeJwtString, string base32Secret)
{
//Parse jwt
using JsonWebToken jwt = JsonWebToken.Parse(upgradeJwtString);
@@ -340,7 +349,7 @@ namespace VNLib.Plugins.Essentials.Accounts.MFA
/// <param name="login">The message from the user requesting the login</param>
/// <returns>A signed upgrade message the client will pass back to the server after the MFA verification</returns>
/// <exception cref="InvalidOperationException"></exception>
- public static MfaUpgradeMessage? MFAGetUpgradeIfEnabled(this IUser user, MFAConfig? conf, LoginMessage login)
+ internal static MfaUpgradeMessage? MFAGetUpgradeIfEnabled(this IUser user, MFAConfig? conf, LoginMessage login)
{
//Webauthn config
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 c96900e..09423ed 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.5.2" />
+ <PackageReference Include="FluentValidation" Version="11.6.0" />
</ItemGroup>
<ItemGroup>