Bearer middleware: add "infer algorithm from key" (#3033)

Signed-off-by: ItalyPaleAle <43508+ItalyPaleAle@users.noreply.github.com>
This commit is contained in:
Alessandro (Ale) Segala 2023-08-03 07:37:22 -07:00 committed by GitHub
parent 7937d34bb7
commit 8b6156f4f7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 1 deletions

View File

@ -23,6 +23,7 @@ import (
"github.com/lestrrat-go/httprc"
"github.com/lestrrat-go/jwx/v2/jwk"
"github.com/lestrrat-go/jwx/v2/jws"
"github.com/lestrrat-go/jwx/v2/jwt"
"github.com/dapr/components-contrib/internal/httputils"
@ -112,7 +113,7 @@ func (m *Middleware) GetHandler(ctx context.Context, metadata middleware.Metadat
_, err = jwt.Parse([]byte(rawToken),
jwt.WithContext(r.Context()),
jwt.WithAcceptableSkew(allowedClockSkew),
jwt.WithKeySet(keyset),
jwt.WithKeySet(keyset, jws.WithInferAlgorithmFromKey(true)),
jwt.WithAudience(meta.Audience),
jwt.WithIssuer(meta.Issuer),
)