summaryrefslogtreecommitdiff
path: root/internal/handlers/handler_logout.go
diff options
context:
space:
mode:
authorClement Michaud <clement.michaud34@gmail.com>2019-11-17 11:47:07 +0100
committerClément Michaud <clement.michaud34@gmail.com>2019-11-17 16:30:33 +0100
commit3b2d733367c88621e4178301f2bcb4bc03613eee (patch)
tree41ac41fc5b6cece04db85a08bfa7c32a022f7354 /internal/handlers/handler_logout.go
parenta06b69dd458e756f1a3d6867eb5b9f54560e2ee1 (diff)
Move source code into internal directory to follow standard project layout.
https://github.com/golang-standards/project-layout
Diffstat (limited to 'internal/handlers/handler_logout.go')
-rw-r--r--internal/handlers/handler_logout.go19
1 files changed, 19 insertions, 0 deletions
diff --git a/internal/handlers/handler_logout.go b/internal/handlers/handler_logout.go
new file mode 100644
index 000000000..36e4d33c9
--- /dev/null
+++ b/internal/handlers/handler_logout.go
@@ -0,0 +1,19 @@
+package handlers
+
+import (
+ "fmt"
+
+ "github.com/clems4ever/authelia/internal/middlewares"
+)
+
+// LogoutPost is the handler logging out the user attached to the given cookie.
+func LogoutPost(ctx *middlewares.AutheliaCtx) {
+ ctx.Logger.Tracef("Destroy session")
+ err := ctx.Providers.SessionProvider.DestroySession(ctx.RequestCtx)
+
+ if err != nil {
+ ctx.Error(fmt.Errorf("Unable to destroy session during logout: %s", err), operationFailedMessage)
+ }
+
+ ctx.ReplyOK()
+}