aboutsummaryrefslogtreecommitdiff
path: root/VNLib.Plugins.Essentials.Accounts/Endpoints/LogoutEndpoint.cs
diff options
context:
space:
mode:
authorLibravatar vman <public@vaughnnugent.com>2022-11-18 16:08:51 -0500
committerLibravatar vman <public@vaughnnugent.com>2022-11-18 16:08:51 -0500
commit526c2364b9ad685d1c000fc8a168bf1305aaa8b7 (patch)
treea2bc01607320a6a75e1a869d5bd34e79fd63c595 /VNLib.Plugins.Essentials.Accounts/Endpoints/LogoutEndpoint.cs
parent2080400119be00bdc354f3121d84ec2f89606ac7 (diff)
Add project files.
Diffstat (limited to 'VNLib.Plugins.Essentials.Accounts/Endpoints/LogoutEndpoint.cs')
-rw-r--r--VNLib.Plugins.Essentials.Accounts/Endpoints/LogoutEndpoint.cs34
1 files changed, 34 insertions, 0 deletions
diff --git a/VNLib.Plugins.Essentials.Accounts/Endpoints/LogoutEndpoint.cs b/VNLib.Plugins.Essentials.Accounts/Endpoints/LogoutEndpoint.cs
new file mode 100644
index 0000000..c52eef5
--- /dev/null
+++ b/VNLib.Plugins.Essentials.Accounts/Endpoints/LogoutEndpoint.cs
@@ -0,0 +1,34 @@
+using System;
+using System.Net;
+using System.Text.Json;
+using System.Collections.Generic;
+
+using VNLib.Plugins.Extensions.Loading;
+using VNLib.Plugins.Essentials.Endpoints;
+
+namespace VNLib.Plugins.Essentials.Accounts.Endpoints
+{
+ [ConfigurationName("logout_endpoint")]
+ internal class LogoutEndpoint : ProtectedWebEndpoint
+ {
+ //Use default ep protection (most strict)
+
+ ///<inheritdoc/>
+ protected override ProtectionSettings EndpointProtectionSettings { get; } = new();
+
+
+ public LogoutEndpoint(PluginBase pbase, IReadOnlyDictionary<string, JsonElement> config)
+ {
+ string? path = config["path"].GetString();
+ InitPathAndLog(path, pbase.Log);
+ }
+
+
+ protected override VfReturnType Post(HttpEntity entity)
+ {
+ entity.InvalidateLogin();
+ entity.CloseResponse(HttpStatusCode.OK);
+ return VfReturnType.VirtualSkip;
+ }
+ }
+}