Skip to content

Commit

Permalink
Improve auth debugging
Browse files Browse the repository at this point in the history
  • Loading branch information
DavidS-ovm committed Dec 10, 2024
1 parent aaa1bc5 commit 37b398a
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion middleware.go
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,11 @@ func ensureValidTokenHandler(config AuthConfig, next http.Handler) http.Handler
}

errorHandler := func(w http.ResponseWriter, r *http.Request, err error) {
log.WithContext(r.Context()).WithError(err).Errorf("Encountered error while validating JWT")
log.WithContext(r.Context()).WithFields(log.Fields{
"ovm.auth.audience": config.Auth0Audience,
"ovm.auth.domain": config.Auth0Domain,
"ovm.auth.expectedIssuer": issuerURL.String(),
}).WithError(err).Errorf("Encountered error while validating JWT")

w.Header().Set("Content-Type", "application/json")
w.WriteHeader(http.StatusUnauthorized)
Expand Down

0 comments on commit 37b398a

Please sign in to comment.