diff options
Diffstat (limited to 'internal/handlers/handler_logout.go')
| -rw-r--r-- | internal/handlers/handler_logout.go | 19 |
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() +} |
