Skip to content

Commit

Permalink
idp: Always use custom http client when generating tokens (#838)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
vadmeste committed Jun 26, 2021
1 parent c6eae4b commit 173c3d4
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion pkg/auth/idp/oauth2/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)

Expand Down Expand Up @@ -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
}
Expand Down

0 comments on commit 173c3d4

Please sign in to comment.