2019-04-24 21:52:08 +00:00
|
|
|
package handlers
|
|
|
|
|
|
|
|
import (
|
|
|
|
"fmt"
|
|
|
|
|
2019-12-24 02:14:52 +00:00
|
|
|
"github.com/authelia/authelia/internal/middlewares"
|
2019-04-24 21:52:08 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
// 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")
|
2019-04-24 21:52:08 +00:00
|
|
|
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()
|
|
|
|
}
|