Skip to content

Commit

Permalink
Use json.NewDecoder
Browse files Browse the repository at this point in the history
  • Loading branch information
mortenmj committed Oct 13, 2023
1 parent c36da1c commit ba426d0
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions pkg/jwt/configuration.go
Original file line number Diff line number Diff line change
Expand Up @@ -156,13 +156,14 @@ func NewSignatureValidatorFromJSONWebKeySetFile(path string, group program.Group
}

func getJwksFromFile(path string) (SignatureValidator, error) {
jwksJSON, err := os.ReadFile(path)
r, err := os.Open(path)
if err != nil {
return nil, err
}

var jwks jose.JSONWebKeySet
if err := json.Unmarshal(jwksJSON, &jwks); err != nil {
err = json.NewDecoder(r).Decode(&jwks)
if err != nil {
return nil, err
}

Expand Down

0 comments on commit ba426d0

Please sign in to comment.