Skip to content

Commit 8b6156f

Browse files
authored
Bearer middleware: add "infer algorithm from key" (#3033)
Signed-off-by: ItalyPaleAle <[email protected]>
1 parent 7937d34 commit 8b6156f

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

middleware/http/bearer/bearer_middleware.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ import (
2323

2424
"github.com/lestrrat-go/httprc"
2525
"github.com/lestrrat-go/jwx/v2/jwk"
26+
"github.com/lestrrat-go/jwx/v2/jws"
2627
"github.com/lestrrat-go/jwx/v2/jwt"
2728

2829
"github.com/dapr/components-contrib/internal/httputils"
@@ -112,7 +113,7 @@ func (m *Middleware) GetHandler(ctx context.Context, metadata middleware.Metadat
112113
_, err = jwt.Parse([]byte(rawToken),
113114
jwt.WithContext(r.Context()),
114115
jwt.WithAcceptableSkew(allowedClockSkew),
115-
jwt.WithKeySet(keyset),
116+
jwt.WithKeySet(keyset, jws.WithInferAlgorithmFromKey(true)),
116117
jwt.WithAudience(meta.Audience),
117118
jwt.WithIssuer(meta.Issuer),
118119
)

0 commit comments

Comments
 (0)