associate user object with current request via middleware
This commit is contained in:
parent
476a88ea2a
commit
40f717d683
|
@ -15,7 +15,7 @@ func AuthMiddleware(requireValidUser bool) gin.HandlerFunc {
|
||||||
|
|
||||||
currentUser := iam.GetCurrentUser(c)
|
currentUser := iam.GetCurrentUser(c)
|
||||||
|
|
||||||
if requireValidUser && (currentUser == "") {
|
if requireValidUser && (currentUser == nil) {
|
||||||
c.SetCookie("jwt", "", -1, "/", "", c.Request.URL.Scheme == "https", true)
|
c.SetCookie("jwt", "", -1, "/", "", c.Request.URL.Scheme == "https", true)
|
||||||
c.Redirect(http.StatusSeeOther, "/")
|
c.Redirect(http.StatusSeeOther, "/")
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue