Auth: Don't clear auth token cookie when lookup token fails (#32999)

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

Ref #15316
This commit is contained in:
Marcus Efraimsson 2021-04-19 19:46:25 +02:00 committed by GitHub
parent 3e3a0a1ea1
commit 747f3cd300
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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
}