Skip to content

Commit

Permalink
Auth: Remove the session cookie only if it's invalid or revoked (graf…
Browse files Browse the repository at this point in the history
…ana#65984)

Remove the cookie if it's invalid or revoked
  • Loading branch information
mgyongyosi authored Apr 13, 2023
1 parent 8e03bad commit 4cac95d
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions pkg/services/contexthandler/contexthandler.go
Original file line number Diff line number Diff line change
Expand Up @@ -481,8 +481,8 @@ func (h *ContextHandler) initContextWithToken(reqContext *contextmodel.ReqContex
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, auth.ErrUserTokenNotFound) || errors.Is(err, auth.ErrInvalidSessionToken) {
// Burn the cookie in case of invalid, expired or missing token
if errors.Is(err, auth.ErrInvalidSessionToken) {
// Burn the cookie in case of invalid or revoked token
reqContext.Resp.Before(h.deleteInvalidCookieEndOfRequestFunc(reqContext))
}

Expand Down

0 comments on commit 4cac95d

Please sign in to comment.