Restrict the cookie to the /adm and /sec paths appropriately
This commit is contained in:
@@ -24,8 +24,6 @@ type signup struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const JwtHeader = "jwt"
|
const JwtHeader = "jwt"
|
||||||
const ServicePath = "TODOPATH"
|
|
||||||
const ServiceDomain = "TODODOMAIN"
|
|
||||||
|
|
||||||
func UserSignup() gin.HandlerFunc {
|
func UserSignup() gin.HandlerFunc {
|
||||||
return func(c *gin.Context) {
|
return func(c *gin.Context) {
|
||||||
@@ -85,7 +83,7 @@ func UserLogin() gin.HandlerFunc {
|
|||||||
}
|
}
|
||||||
|
|
||||||
jwt, maxAge := u.GetJwt()
|
jwt, maxAge := u.GetJwt()
|
||||||
c.SetCookie(JwtHeader, jwt, maxAge, ServicePath, ServiceDomain, true, true)
|
c.SetCookie(JwtHeader, jwt, maxAge, "/v1/sec/", "", true, true)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -117,7 +115,7 @@ func AdminLogin() gin.HandlerFunc {
|
|||||||
}
|
}
|
||||||
|
|
||||||
jwt, maxAge := a.GetJwt()
|
jwt, maxAge := a.GetJwt()
|
||||||
c.SetCookie(JwtHeader, jwt, maxAge, ServicePath, ServiceDomain, true, true)
|
c.SetCookie(JwtHeader, jwt, maxAge, "/v1/adm", "", true, true)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user