feat(op): user slog for logging
integrate with golang.org/x/exp/slog for logging. provide a middleware for request scoped logging. BREAKING CHANGES: 1. OpenIDProvider and sub-interfaces get a Logger() method to return the configured logger; 2. AuthRequestError now takes the complete Authorizer, instead of only the encoder. So that it may use its Logger() method. 3. RequestError now takes a Logger as argument.
This commit is contained in:
parent
6708ef4c24
commit
f30f0d3ead
22 changed files with 297 additions and 61 deletions
|
@ -18,23 +18,23 @@ type JWTAuthorizationGrantExchanger interface {
|
|||
func JWTProfile(w http.ResponseWriter, r *http.Request, exchanger JWTAuthorizationGrantExchanger) {
|
||||
profileRequest, err := ParseJWTProfileGrantRequest(r, exchanger.Decoder())
|
||||
if err != nil {
|
||||
RequestError(w, r, err)
|
||||
RequestError(w, r, err, exchanger.Logger())
|
||||
}
|
||||
|
||||
tokenRequest, err := VerifyJWTAssertion(r.Context(), profileRequest.Assertion, exchanger.JWTProfileVerifier(r.Context()))
|
||||
if err != nil {
|
||||
RequestError(w, r, err)
|
||||
RequestError(w, r, err, exchanger.Logger())
|
||||
return
|
||||
}
|
||||
|
||||
tokenRequest.Scopes, err = exchanger.Storage().ValidateJWTProfileScopes(r.Context(), tokenRequest.Issuer, profileRequest.Scope)
|
||||
if err != nil {
|
||||
RequestError(w, r, err)
|
||||
RequestError(w, r, err, exchanger.Logger())
|
||||
return
|
||||
}
|
||||
resp, err := CreateJWTTokenResponse(r.Context(), tokenRequest, exchanger)
|
||||
if err != nil {
|
||||
RequestError(w, r, err)
|
||||
RequestError(w, r, err, exchanger.Logger())
|
||||
return
|
||||
}
|
||||
httphelper.MarshalJSON(w, resp)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue