2019-04-25 04:52:08 +07:00
|
|
|
package handlers
|
|
|
|
|
|
|
|
import (
|
|
|
|
"fmt"
|
|
|
|
|
2019-12-24 09:14:52 +07:00
|
|
|
"github.com/authelia/authelia/internal/middlewares"
|
2019-04-25 04:52:08 +07:00
|
|
|
)
|
|
|
|
|
|
|
|
// LogoutPost is the handler logging out the user attached to the given cookie.
|
|
|
|
func LogoutPost(ctx *middlewares.AutheliaCtx) {
|
2019-11-17 02:50:58 +07:00
|
|
|
ctx.Logger.Tracef("Destroy session")
|
2019-04-25 04:52:08 +07: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()
|
|
|
|
}
|