Compare commits

...
Sign in to create a new pull request.

1 commit

Author SHA1 Message Date
Tim Möhlmann
eb249c4c70 chore(example): add supported signing algorithms to RP 2024-08-19 21:04:21 +03:00

View file

@ -11,6 +11,7 @@ import (
"sync/atomic" "sync/atomic"
"time" "time"
"github.com/go-jose/go-jose/v4"
"github.com/google/uuid" "github.com/google/uuid"
"github.com/sirupsen/logrus" "github.com/sirupsen/logrus"
@ -53,7 +54,23 @@ func main() {
options := []rp.Option{ options := []rp.Option{
rp.WithCookieHandler(cookieHandler), rp.WithCookieHandler(cookieHandler),
rp.WithVerifierOpts(rp.WithIssuedAtOffset(5 * time.Second)), rp.WithVerifierOpts(
rp.WithIssuedAtOffset(5*time.Second),
// When the OP uses other signing algorithms then RS256,
// We need to tell the RP to accept them.
// The actual handshake is done with the "kid" and "alg" header claims.
// However, [jose.ParseSigned] needs a list of algorithms we are willing to accept.
// This example sets all the algorithms the ZITADEL product supports.
rp.WithSupportedSigningAlgorithms(
string(jose.EdDSA),
string(jose.RS256),
string(jose.RS384),
string(jose.RS512),
string(jose.ES256),
string(jose.ES384),
string(jose.ES512),
),
),
rp.WithHTTPClient(client), rp.WithHTTPClient(client),
rp.WithLogger(logger), rp.WithLogger(logger),
} }