fix: if claim is empty and ExpiredAllowed on, abort early and pass through

This commit is contained in:
Derrick Hammer 2024-03-20 14:41:54 -04:00
parent 7df6bb245b
commit 52a1f18c60
Signed by: pcfreak30
GPG Key ID: C997C339BE476FF2
1 changed files with 5 additions and 0 deletions

View File

@ -176,6 +176,11 @@ func AuthMiddleware(options AuthMiddlewareOptions) func(http.Handler) http.Handl
}
}
if claim == nil && options.ExpiredAllowed {
next.ServeHTTP(w, r)
return
}
userId, err := strconv.ParseUint(claim.Subject, 10, 64)
if err != nil {