Skip to content

Commit

Permalink
Auth: Don't clear auth token cookie when lookup token fails (grafana#…
Browse files Browse the repository at this point in the history
…32999)

If LookupToken fails we don't clear the auth token cookie.

Ref grafana#15316
  • Loading branch information
marefr authored Apr 19, 2021
1 parent 3e3a0a1 commit 747f3cd
Showing 1 changed file with 0 additions and 6 deletions.
6 changes: 0 additions & 6 deletions pkg/services/contexthandler/contexthandler.go
Original file line number Diff line number Diff line change
Expand Up @@ -259,12 +259,6 @@ func (h *ContextHandler) initContextWithToken(ctx *models.ReqContext, orgID int6
token, err := h.AuthTokenService.LookupToken(ctx.Req.Context(), rawToken)
if err != nil {
ctx.Logger.Error("Failed to look up user based on cookie", "error", err)

var revokedErr *models.TokenRevokedError
if !errors.As(err, &revokedErr) || !ctx.IsApiRequest() {
cookies.WriteSessionCookie(ctx, h.Cfg, "", -1)
}

ctx.Data["lookupTokenErr"] = err
return false
}
Expand Down

0 comments on commit 747f3cd

Please sign in to comment.