mirror of
https://github.com/weloe/token-go.git
synced 2025-10-03 14:46:29 +08:00
refactor: update default cookie path
This commit is contained in:
@@ -11,7 +11,7 @@ type CookieConfig struct {
|
|||||||
func DefaultCookieConfig() *CookieConfig {
|
func DefaultCookieConfig() *CookieConfig {
|
||||||
return &CookieConfig{
|
return &CookieConfig{
|
||||||
Domain: "",
|
Domain: "",
|
||||||
Path: "",
|
Path: "/",
|
||||||
Secure: false,
|
Secure: false,
|
||||||
HttpOnly: false,
|
HttpOnly: false,
|
||||||
SameSite: "",
|
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
|
// add cookie use tokenConfig.CookieConfig
|
||||||
ctx.Response().AddCookie(tokenConfig.TokenName,
|
ctx.Response().AddCookie(tokenConfig.TokenName,
|
||||||
tokenValue,
|
tokenValue,
|
||||||
|
Reference in New Issue
Block a user