authelia/internal/handlers/handler_logout.go

20 lines
467 B
Go
Raw Normal View History

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) {
2019-11-16 19:50:58 +00:00
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()
}