From 173c3d43bb2726639fb0b344edbdbcee7ac806bd Mon Sep 17 00:00:00 2001 From: Anis Elleuch Date: Sat, 26 Jun 2021 17:23:42 +0100 Subject: [PATCH] idp: Always use custom http client when generating tokens (#838) x/oauth2 always wants a context with a custom http client embedded when performing various requests. Ensure that the custom http client is passed when requesting for a token. --- pkg/auth/idp/oauth2/provider.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pkg/auth/idp/oauth2/provider.go b/pkg/auth/idp/oauth2/provider.go index ca10c6cea..079370445 100644 --- a/pkg/auth/idp/oauth2/provider.go +++ b/pkg/auth/idp/oauth2/provider.go @@ -33,6 +33,7 @@ import ( "github.com/coreos/go-oidc" "github.com/minio/console/pkg/auth/utils" "golang.org/x/crypto/pbkdf2" + "golang.org/x/oauth2" xoauth2 "golang.org/x/oauth2" ) @@ -167,7 +168,8 @@ func (client *Provider) VerifyIdentity(ctx context.Context, code, state string) return nil, err } getWebTokenExpiry := func() (*credentials.WebIdentityToken, error) { - oauth2Token, err := client.oauth2Config.Exchange(ctx, code) + customCtx := context.WithValue(ctx, oauth2.HTTPClient, client.provHTTPClient) + oauth2Token, err := client.oauth2Config.Exchange(customCtx, code) if err != nil { return nil, err }