Skip to content

Commit

Permalink
plugins/rest: Do local map modification in OAuth2 client credentials …
Browse files Browse the repository at this point in the history
…flow

Fixes: open-policy-agent#6769

Signed-off-by: eubaranov <evgeniy.baranov@deliveryhero.com>
  • Loading branch information
eubaranov authored May 30, 2024
1 parent eeb6338 commit f2ffbd6
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions plugins/rest/auth.go
Original file line number Diff line number Diff line change
Expand Up @@ -294,16 +294,13 @@ type oauth2Token struct {
ExpiresAt time.Time
}

func (ap *oauth2ClientCredentialsAuthPlugin) createAuthJWT(ctx context.Context, claims map[string]interface{}, signingKey interface{}) (*string, error) {
func (ap *oauth2ClientCredentialsAuthPlugin) createAuthJWT(ctx context.Context, extClaims map[string]interface{}, signingKey interface{}) (*string, error) {
now := time.Now()
baseClaims := map[string]interface{}{
claims := map[string]interface{}{
"iat": now.Unix(),
"exp": now.Add(10 * time.Minute).Unix(),
}
if claims == nil {
claims = make(map[string]interface{})
}
for k, v := range baseClaims {
for k, v := range extClaims {
claims[k] = v
}

Expand Down

0 comments on commit f2ffbd6

Please sign in to comment.