From 76e6fc7e60c0f3c05fa86ee82cdae934e390e964 Mon Sep 17 00:00:00 2001 From: Stefan Benz <46600784+stebenz@users.noreply.github.com> Date: Fri, 30 Aug 2024 12:47:45 +0200 Subject: [PATCH 1/3] fix: context background for well-known call --- zitadel/helper/client.go | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/zitadel/helper/client.go b/zitadel/helper/client.go index 7f0e4017..1c77a2ea 100644 --- a/zitadel/helper/client.go +++ b/zitadel/helper/client.go @@ -37,13 +37,13 @@ func GetClientInfo(ctx context.Context, insecure bool, domain string, token stri options := make([]zitadel.Option, 0) keyPath := "" if token != "" { - options = append(options, zitadel.WithJWTProfileTokenSource(middleware.JWTProfileFromPath(ctx, token))) + options = append(options, zitadel.WithJWTProfileTokenSource(middleware.JWTProfileFromPath(context.Background(), token))) keyPath = token } else if jwtProfileFile != "" { - options = append(options, zitadel.WithJWTProfileTokenSource(middleware.JWTProfileFromPath(ctx, jwtProfileFile))) + options = append(options, zitadel.WithJWTProfileTokenSource(middleware.JWTProfileFromPath(context.Background(), jwtProfileFile))) keyPath = jwtProfileFile } else if jwtProfileJSON != "" { - options = append(options, zitadel.WithJWTProfileTokenSource(middleware.JWTProfileFromFileData(ctx, []byte(jwtProfileJSON)))) + options = append(options, zitadel.WithJWTProfileTokenSource(middleware.JWTProfileFromFileData(context.Background(), []byte(jwtProfileJSON)))) } else { return nil, fmt.Errorf("either 'jwt_profile_file' or 'jwt_profile_json' is required") } @@ -91,7 +91,7 @@ func GetAdminClient(ctx context.Context, info *ClientInfo) (*admin.Client, error if adminClient == nil { client, err := admin.NewClient(ctx, info.Issuer, info.Domain, - []string{oidc.ScopeOpenID, zitadel.ScopeZitadelAPI()}, + []string{oidc.ScopeOpenID}, info.Options..., ) if err != nil { @@ -112,9 +112,9 @@ func GetManagementClient(ctx context.Context, info *ClientInfo) (*management.Cli mgmtClientLock.Lock() defer mgmtClientLock.Unlock() if mgmtClient == nil { - client, err := management.NewClient(ctx, + client, err := management.NewClient(context.Background(), info.Issuer, info.Domain, - []string{oidc.ScopeOpenID, zitadel.ScopeZitadelAPI()}, + []string{oidc.ScopeOpenID}, info.Options..., ) if err != nil { From 04023cc7539334caab0b140dda1a209dfdc7a1af Mon Sep 17 00:00:00 2001 From: Stefan Benz <46600784+stebenz@users.noreply.github.com> Date: Mon, 2 Sep 2024 13:32:57 +0200 Subject: [PATCH 2/3] fix: context background for well-known call --- zitadel/helper/client.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zitadel/helper/client.go b/zitadel/helper/client.go index 1c77a2ea..cb774701 100644 --- a/zitadel/helper/client.go +++ b/zitadel/helper/client.go @@ -112,7 +112,7 @@ func GetManagementClient(ctx context.Context, info *ClientInfo) (*management.Cli mgmtClientLock.Lock() defer mgmtClientLock.Unlock() if mgmtClient == nil { - client, err := management.NewClient(context.Background(), + client, err := management.NewClient(ctx, info.Issuer, info.Domain, []string{oidc.ScopeOpenID}, info.Options..., From 2a882c289526771c3effba138f2ef5688b5467f5 Mon Sep 17 00:00:00 2001 From: Stefan Benz <46600784+stebenz@users.noreply.github.com> Date: Mon, 2 Sep 2024 13:33:27 +0200 Subject: [PATCH 3/3] fix: context background for well-known call --- zitadel/helper/client.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/zitadel/helper/client.go b/zitadel/helper/client.go index cb774701..a0fc37a5 100644 --- a/zitadel/helper/client.go +++ b/zitadel/helper/client.go @@ -91,7 +91,7 @@ func GetAdminClient(ctx context.Context, info *ClientInfo) (*admin.Client, error if adminClient == nil { client, err := admin.NewClient(ctx, info.Issuer, info.Domain, - []string{oidc.ScopeOpenID}, + []string{oidc.ScopeOpenID, zitadel.ScopeZitadelAPI()}, info.Options..., ) if err != nil { @@ -114,7 +114,7 @@ func GetManagementClient(ctx context.Context, info *ClientInfo) (*management.Cli if mgmtClient == nil { client, err := management.NewClient(ctx, info.Issuer, info.Domain, - []string{oidc.ScopeOpenID}, + []string{oidc.ScopeOpenID, zitadel.ScopeZitadelAPI()}, info.Options..., ) if err != nil {