mirror of
https://github.com/weloe/token-go.git
synced 2025-10-02 22:32:16 +08:00
refactor: update default cookie path
This commit is contained in:
@@ -11,7 +11,7 @@ type CookieConfig struct {
|
||||
func DefaultCookieConfig() *CookieConfig {
|
||||
return &CookieConfig{
|
||||
Domain: "",
|
||||
Path: "",
|
||||
Path: "/",
|
||||
Secure: false,
|
||||
HttpOnly: false,
|
||||
SameSite: "",
|
||||
|
@@ -71,6 +71,10 @@ func (e *Enforcer) responseToken(tokenValue string, loginModel *model.Login, ctx
|
||||
}
|
||||
}
|
||||
|
||||
if tokenConfig.CookieConfig.Path == "" {
|
||||
tokenConfig.CookieConfig.Path = "/"
|
||||
}
|
||||
|
||||
// add cookie use tokenConfig.CookieConfig
|
||||
ctx.Response().AddCookie(tokenConfig.TokenName,
|
||||
tokenValue,
|
||||
|
Reference in New Issue
Block a user