Skip to content

Commit

Permalink
After master merge fixes:
Browse files Browse the repository at this point in the history
Replace c.newHTTPClient() with c.httpClient in OpenID4VPClient

Instead of creating a new HTTPClient instance every time one of these functions is called, the pre-existing httpClient provided by the OpenID4VPClient struct is now used.
  • Loading branch information
rolandgroen committed Apr 8, 2024
1 parent 6e296ba commit 5c7583a
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions auth/client/iam/openid4vp.go
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ func (c *OpenID4VPClient) RequestRFC021AccessToken(ctx context.Context, requeste
}, nil
}
func (c *OpenID4VPClient) OpenIdConfiguration(ctx context.Context, serverURL string) (*oauth.OpenIDConfigurationMetadata, error) {
iamClient := c.newHTTPClient()
iamClient := c.httpClient
rsp, err := iamClient.OpenIdConfiguration(ctx, serverURL)
if err != nil {
return nil, fmt.Errorf("failed to retrieve Openid configuration: %w", err)
Expand All @@ -274,7 +274,7 @@ func (c *OpenID4VPClient) OpenIdConfiguration(ctx context.Context, serverURL str
}

func (c *OpenID4VPClient) OpenIdCredentialIssuerMetadata(ctx context.Context, webDID did.DID) (*oauth.OpenIDCredentialIssuerMetadata, error) {
iamClient := c.newHTTPClient()
iamClient := c.httpClient
rsp, err := iamClient.OpenIdCredentialIssuerMetadata(ctx, webDID)
if err != nil {
return nil, fmt.Errorf("failed to retrieve Openid credential issuer metadata: %w", err)
Expand All @@ -283,7 +283,7 @@ func (c *OpenID4VPClient) OpenIdCredentialIssuerMetadata(ctx context.Context, we
}

func (c *OpenID4VPClient) AccessTokenOid4vci(ctx context.Context, clientId string, tokenEndpoint string, redirectUri string, code string, pkceCodeVerifier *string) (*oauth.Oid4vciTokenResponse, error) {
iamClient := c.newHTTPClient()
iamClient := c.httpClient
data := url.Values{}
data.Set("client_id", clientId)
data.Set(oauth.GrantTypeParam, oauth.AuthorizationCodeGrantType)
Expand Down Expand Up @@ -329,7 +329,7 @@ func (c *OpenID4VPClient) VerifiableCredentials(ctx context.Context, credentialE
if err != nil {
return nil, err
}
iamClient := c.newHTTPClient()
iamClient := c.httpClient
rsp, err := iamClient.VerifiableCredentials(ctx, credentialEndpoint, accessToken, proofJwt)
if err != nil {
return nil, fmt.Errorf("remote server: failed to retrieve credentials: %w", err)
Expand Down

0 comments on commit 5c7583a

Please sign in to comment.