From 2ea1a80c86e8f4e77cd8cedd5badc210fdac3a3b Mon Sep 17 00:00:00 2001
From: Maksim Nabokikh <maksim.nabokikh@flant.com>
Date: Fri, 10 Feb 2023 20:56:31 +0400
Subject: [PATCH] fix: propagate http client to userInfo requests for OIDC
 connector (#2781)

Signed-off-by: m.nabokikh <maksim.nabokikh@flant.com>
---
 connector/oidc/oidc.go | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/connector/oidc/oidc.go b/connector/oidc/oidc.go
index 56aad4b3..5c10f74a 100644
--- a/connector/oidc/oidc.go
+++ b/connector/oidc/oidc.go
@@ -260,7 +260,7 @@ func (c *oidcConnector) HandleCallback(s connector.Scopes, r *http.Request) (ide
 	if err != nil {
 		return identity, fmt.Errorf("oidc: failed to get token: %v", err)
 	}
-	return c.createIdentity(r.Context(), identity, token, createCaller)
+	return c.createIdentity(ctx, identity, token, createCaller)
 }
 
 // Refresh is used to refresh a session with the refresh token provided by the IdP
@@ -271,6 +271,8 @@ func (c *oidcConnector) Refresh(ctx context.Context, s connector.Scopes, identit
 		return identity, fmt.Errorf("oidc: failed to unmarshal connector data: %v", err)
 	}
 
+	ctx = context.WithValue(ctx, oauth2.HTTPClient, c.httpClient)
+
 	t := &oauth2.Token{
 		RefreshToken: string(cd.RefreshToken),
 		Expiry:       time.Now().Add(-time.Hour),
-- 
GitLab