Skip to content
This repository has been archived by the owner on Nov 11, 2024. It is now read-only.

LogoutHandler 好像存在一个bug #28

Open
FxStar opened this issue Nov 16, 2023 · 0 comments
Open

LogoutHandler 好像存在一个bug #28

FxStar opened this issue Nov 16, 2023 · 0 comments

Comments

@FxStar
Copy link

FxStar commented Nov 16, 2023

func (mw *GfJWTMiddleware) LogoutHandler(ctx context.Context) {
r := g.RequestFromCtx(ctx)

// delete auth cookie
if mw.SendCookie {
	r.Cookie.SetCookie(mw.CookieName, "", mw.CookieDomain, "/", -1)
}

claims, token, err := mw.CheckIfTokenExpire(ctx)
if err != nil {
	mw.unauthorized(ctx, http.StatusUnauthorized, mw.HTTPStatusMessageFunc(err, ctx))
	return
}

err = mw.setBlacklist(ctx, token, claims)

if err != nil {
	mw.unauthorized(ctx, http.StatusUnauthorized, mw.HTTPStatusMessageFunc(err, ctx))
	return
}

return

}

当只有 cookie 存在token 时 此处先把cookie 给清了 导致 一直401 实际token 还有效 并没有退出登陆

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant