associate user object with current request via middleware

This commit is contained in:
James Ravenscroft 2022-02-06 12:06:41 +00:00
parent 476a88ea2a
commit 40f717d683
1 changed files with 1 additions and 1 deletions

View File

@ -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, "/")
} }