[v9.3.x] Auth: Remove the session cookie only if it's invalid or revoked (#68796)
Auth: Remove the session cookie only if it's invalid or revoked (#65984)
Remove the cookie if it's invalid or revoked
(cherry picked from commit 4cac95d1c2)
This commit is contained in:
@@ -451,8 +451,8 @@ func (h *ContextHandler) initContextWithToken(reqContext *models.ReqContext, org
|
||||
token, err := h.AuthTokenService.LookupToken(ctx, rawToken)
|
||||
if err != nil {
|
||||
reqContext.Logger.Warn("failed to look up session from cookie", "error", err)
|
||||
if errors.Is(err, models.ErrUserTokenNotFound) || errors.Is(err, models.ErrInvalidSessionToken) {
|
||||
// Burn the cookie in case of invalid, expired or missing token
|
||||
if errors.Is(err, models.ErrInvalidSessionToken) {
|
||||
// Burn the cookie in case of invalid or revoked token
|
||||
reqContext.Resp.Before(h.deleteInvalidCookieEndOfRequestFunc(reqContext))
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user