reduce dbg level of failed auth msg

This commit is contained in:
Umputun
2018-05-25 17:08:21 -05:00
parent 38095ec3b5
commit e8838f475e
+3 -2
View File
@@ -41,7 +41,7 @@ func (a *Authenticator) Auth(reqAuth bool) func(http.Handler) http.Handler {
claims, err := a.JWTService.Get(r)
if err != nil && reqAuth { // in full auth lack of session causes Unauthorized
log.Printf("[WARN] failed auth, %s", err)
log.Printf("[DEBUG] failed auth, %s", err)
http.Error(w, "Unauthorized", http.StatusUnauthorized)
return
}
@@ -52,6 +52,7 @@ func (a *Authenticator) Auth(reqAuth bool) func(http.Handler) http.Handler {
}
if claims.User == nil && reqAuth {
log.Print("[DEBUG] failed auth, no user info presented in the claim")
http.Error(w, "Unauthorized", http.StatusUnauthorized)
return
}
@@ -61,7 +62,7 @@ func (a *Authenticator) Auth(reqAuth bool) func(http.Handler) http.Handler {
user.Admin = isAdmin(user.ID, a.Admins) // dbl-check for admin to reset admin flag even if token has it
// refresh token if it close to expiration
if _, err := a.JWTService.Refresh(w, r); err != nil {
log.Printf("[WARN] can't refresh jwt, %s", err)
log.Printf("[DEBUG] can't refresh jwt, %s", err)
}
r = rest.SetUserInfo(r, user)
}