Skip to content

Commit

Permalink
fix: incorrect context passthru
Browse files Browse the repository at this point in the history
  • Loading branch information
alnr committed Aug 12, 2024
1 parent ae04899 commit 23c7464
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions oauth2/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -665,7 +665,7 @@ func (h *Handler) getOidcUserInfo(w http.ResponseWriter, r *http.Request) {
interim["jti"] = uuid.New()
interim["iat"] = time.Now().Unix()

keyID, err := h.r.OpenIDJWTStrategy().GetPublicKeyID(r.Context())
keyID, err := h.r.OpenIDJWTStrategy().GetPublicKeyID(ctx)
if err != nil {
h.r.Writer().WriteError(w, r, err)
return
Expand Down Expand Up @@ -727,7 +727,7 @@ type revokeOAuth2Token struct {
// default: errorOAuth2
func (h *Handler) revokeOAuth2Token(w http.ResponseWriter, r *http.Request) {
ctx := r.Context()
events.Trace(r.Context(), events.AccessTokenRevoked)
events.Trace(ctx, events.AccessTokenRevoked)

err := h.r.OAuth2Provider().NewRevocationRequest(ctx, r)
if err != nil {
Expand Down Expand Up @@ -980,13 +980,13 @@ func (h *Handler) oauth2TokenExchange(w http.ResponseWriter, r *http.Request) {
}
session.ClientID = accessRequest.GetClient().GetID()
session.KID = accessTokenKeyID
session.DefaultSession.Claims.Issuer = h.c.IssuerURL(r.Context()).String()
session.DefaultSession.Claims.Issuer = h.c.IssuerURL(ctx).String()
session.DefaultSession.Claims.IssuedAt = time.Now().UTC()

scopes := accessRequest.GetRequestedScopes()

// Added for compatibility with MITREid
if h.c.GrantAllClientCredentialsScopesPerDefault(r.Context()) && len(scopes) == 0 {
if h.c.GrantAllClientCredentialsScopesPerDefault(ctx) && len(scopes) == 0 {
for _, scope := range accessRequest.GetClient().GetScopes() {
accessRequest.GrantScope(scope)
}
Expand Down Expand Up @@ -1089,7 +1089,7 @@ func (h *Handler) oAuth2Authorize(w http.ResponseWriter, r *http.Request, _ http
}

var accessTokenKeyID string
if h.c.AccessTokenStrategy(r.Context(), client.AccessTokenStrategySource(authorizeRequest.GetClient())) == "jwt" {
if h.c.AccessTokenStrategy(ctx, client.AccessTokenStrategySource(authorizeRequest.GetClient())) == "jwt" {
accessTokenKeyID, err = h.r.AccessTokenJWTStrategy().GetPublicKeyID(ctx)
if err != nil {
x.LogError(r, err, h.r.Logger())
Expand Down

0 comments on commit 23c7464

Please sign in to comment.