Skip to content

Commit

Permalink
fix: Authentication status is now DEBUG, auth failure is WARN (#467)
Browse files Browse the repository at this point in the history
Signed-off-by: Bryon Nevis <bryon.nevis@intel.com>
  • Loading branch information
bnevis-i authored Mar 9, 2023
1 parent f5fe044 commit 29d4d5b
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions bootstrap/handlers/auth_middleware.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ func VaultAuthenticationHandlerFunc(secretProvider interfaces.SecretProvider, lc
return func(inner http.HandlerFunc) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
authHeader := r.Header.Get("Authorization")
lc.Infof("Authorizing incoming call to '%s' via JWT (Authorization len=%d)", r.URL.Path, len(authHeader))
lc.Debugf("Authorizing incoming call to '%s' via JWT (Authorization len=%d)", r.URL.Path, len(authHeader))
authParts := strings.Split(authHeader, " ")
if len(authParts) >= 2 && strings.EqualFold(authParts[0], "Bearer") {
token := authParts[1]
Expand All @@ -57,11 +57,11 @@ func VaultAuthenticationHandlerFunc(secretProvider interfaces.SecretProvider, lc
http.Error(w, http.StatusText(http.StatusInternalServerError), http.StatusInternalServerError)
return
} else if !validToken {
lc.Infof("Request to '%s' UNAUTHORIZED", r.URL.Path)
lc.Warnf("Request to '%s' UNAUTHORIZED", r.URL.Path)
http.Error(w, http.StatusText(http.StatusUnauthorized), http.StatusUnauthorized)
return
}
lc.Infof("Request to '%s' authorized", r.URL.Path)
lc.Debug("Request to '%s' authorized", r.URL.Path)
inner(w, r)
return
}
Expand Down

0 comments on commit 29d4d5b

Please sign in to comment.