Skip to content

[PLUGIN-1956] Added a fix for OAuth2 Proxy Routing#205

Merged
psainics merged 1 commit intodata-integrations:developfrom
vishwasvaidya-cloudsufi:fix_Oauth2_Proxy
Apr 20, 2026
Merged

[PLUGIN-1956] Added a fix for OAuth2 Proxy Routing#205
psainics merged 1 commit intodata-integrations:developfrom
vishwasvaidya-cloudsufi:fix_Oauth2_Proxy

Conversation

@psainics
Copy link
Copy Markdown
Contributor

@psainics psainics commented Apr 20, 2026

Added a fix for OAuth2 Proxy Routing

Jira : PLUGIN-1956

Description

When the HTTP plugin (source or sink) is configured with OAuth2 authentication and a proxy (proxyUrl, proxyUsername, proxyPassword), the request that fetches the OAuth2 access token ignores the proxy settings. It is sent directly to the token endpoint, which causes an UnknownHostException in restricted environments (like Cloud Data Fusion / Dataproc) where only the proxy has outbound network access.
Root Cause
In OAuthUtil.getAccessToken(BaseHttpConfig config), the code builds its own HTTP client but never applies the proxy settings from the config. Currently, it uses HttpClients.custom() (for the source path) or HttpClients.createDefault() (for the sink path), completely bypassing setProxy(...) and setDefaultCredentialsProvider(...).

The Fix

Refactored the OAUTH2 case in OAuthUtil.java to use a unified HttpClientBuilder. The builder now:
Conditionally applies the SSLConnectionSocketFactory (if it's a BaseHttpSourceConfig).
Extracts the proxy settings from the config object and applies the HttpHost and BasicCredentialsProvider (if configured) before calling .build().

Proof / Verifications

  • Pipeline execution logs showing the UnknownHostException failing to resolve the token URL in a restricted environment prior to this fix.
i1
  • Local mock proxy server logs confirming that the POST /token request is now successfully intercepted and routed through the configured proxy port.
i2 i3 i4

@psainics psainics self-assigned this Apr 20, 2026
@psainics psainics added the build label Apr 20, 2026
@google-cla
Copy link
Copy Markdown

google-cla bot commented Apr 20, 2026

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

@psainics psainics requested review from itsankit-google and removed request for itsankit-google April 20, 2026 06:08
if (!Strings.isNullOrEmpty(config.getProxyUrl())) {
HttpHost proxyHost = HttpHost.create(config.getProxyUrl());

if (!Strings.isNullOrEmpty(config.getProxyUsername()) && !Strings.isNullOrEmpty(config.getProxyPassword())) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should the else part throw an error?

Do we have validation in place earlier which checks that these cannot be empty when proxyUrl is specified?

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using the ProxyURL without Credentials is a valid use case, so adding an else part for the same is not required.
Similar type of validations are present where the proxy configuration is implemented. I have also tested these changes locally to verify the same.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see, sounds good.

@psainics psainics merged commit ad3e933 into data-integrations:develop Apr 20, 2026
5 checks passed
@vishwasvaidya-cloudsufi vishwasvaidya-cloudsufi deleted the fix_Oauth2_Proxy branch April 20, 2026 07:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants