cookie: enabled / disabled.

This commit is contained in:
Miroslav Šedivý 2021-04-24 20:53:37 +02:00
parent 9b1deb4134
commit 04d2fa8863
5 changed files with 30 additions and 6 deletions

View file

@ -70,7 +70,10 @@ func (api *ApiManagerCtx) Authenticate(next http.Handler) http.Handler {
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
session, err := api.sessions.Authenticate(r)
if err != nil {
api.sessions.CookieClearToken(w, r)
if api.sessions.CookieEnabled() {
api.sessions.CookieClearToken(w, r)
}
utils.HttpUnauthorized(w, err)
return
}