aboutsummaryrefslogtreecommitdiff
path: root/plugins/VNLib.Plugins.Essentials.Accounts/src/Endpoints/KeepAliveEndpoint.cs
diff options
context:
space:
mode:
authorLibravatar vnugent <public@vaughnnugent.com>2024-07-27 22:06:51 -0400
committerLibravatar vnugent <public@vaughnnugent.com>2024-07-27 22:06:51 -0400
commit48632913da47d77602c8e65275eaa24752258cf9 (patch)
treedb89f1d03e25dc1ecab7ced2f9b22c1926e7c1c5 /plugins/VNLib.Plugins.Essentials.Accounts/src/Endpoints/KeepAliveEndpoint.cs
parent041941d85e5088837dc419d9ff1f1c9b70d41cbf (diff)
add extensions features, fix mising mfa auth. Untested!
Diffstat (limited to 'plugins/VNLib.Plugins.Essentials.Accounts/src/Endpoints/KeepAliveEndpoint.cs')
-rw-r--r--plugins/VNLib.Plugins.Essentials.Accounts/src/Endpoints/KeepAliveEndpoint.cs28
1 files changed, 10 insertions, 18 deletions
diff --git a/plugins/VNLib.Plugins.Essentials.Accounts/src/Endpoints/KeepAliveEndpoint.cs b/plugins/VNLib.Plugins.Essentials.Accounts/src/Endpoints/KeepAliveEndpoint.cs
index ac0c8eb..ec5a49f 100644
--- a/plugins/VNLib.Plugins.Essentials.Accounts/src/Endpoints/KeepAliveEndpoint.cs
+++ b/plugins/VNLib.Plugins.Essentials.Accounts/src/Endpoints/KeepAliveEndpoint.cs
@@ -1,5 +1,5 @@
/*
-* Copyright (c) 2023 Vaughn Nugent
+* Copyright (c) 2024 Vaughn Nugent
*
* Library: VNLib
* Package: VNLib.Plugins.Essentials.Accounts
@@ -27,27 +27,20 @@ using System;
using VNLib.Utils.Extensions;
using VNLib.Plugins.Essentials.Endpoints;
using VNLib.Plugins.Extensions.Loading;
+using VNLib.Plugins.Extensions.Loading.Routing;
namespace VNLib.Plugins.Essentials.Accounts.Endpoints
{
+ [EndpointPath("{{path}}")]
+ [EndpointLogName("Heartbeat")]
[ConfigurationName("keepalive_endpoint")]
- internal sealed class KeepAliveEndpoint : ProtectedWebEndpoint
+ internal sealed class KeepAliveEndpoint(PluginBase plugin, IConfigScope config) : ProtectedWebEndpoint
{
- readonly TimeSpan tokenRegenTime;
-
- /*
- * Endpoint does not use a log, so IniPathAndLog is never called
- * and path verification happens verbosly
- */
- public KeepAliveEndpoint(PluginBase pbase, IConfigScope config)
- {
- string? path = config["path"].GetString();
-
- tokenRegenTime = config["token_refresh_sec"].GetTimeSpan(TimeParseType.Seconds);
-
- InitPathAndLog(path, pbase.Log);
- }
+ private readonly TimeSpan tokenRegenTime = config.GetRequiredProperty(
+ property: "token_refresh_sec",
+ static p => p.GetTimeSpan(TimeParseType.Seconds)
+ );
protected override VfReturnType Get(HttpEntity entity) => VirtualOk(entity);
@@ -64,8 +57,7 @@ namespace VNLib.Plugins.Essentials.Accounts.Endpoints
//reauthorize the client
entity.ReAuthorizeClient(webm);
-
- webm.Success = true;
+
//Send the update message to the client
return VirtualOk(entity, webm);
}