Skip to content
This repository was archived by the owner on May 12, 2026. It is now read-only.

chore: Refactor x509Provider to create a shared Utils class for Mtls#1907

Merged
vverman merged 11 commits into
googleapis:mainfrom
vverman:refactor-x509-provider
Apr 8, 2026
Merged

chore: Refactor x509Provider to create a shared Utils class for Mtls#1907
vverman merged 11 commits into
googleapis:mainfrom
vverman:refactor-x509-provider

Conversation

@vverman

@vverman vverman commented Mar 24, 2026

Copy link
Copy Markdown
Contributor

Fixes googleapis/google-cloud-java#12582

Addressed a concern raised by Andy refer.

Now X509Provider only exposes the necessary methods needed by the MtlsProvider interface

@vverman vverman requested review from a team as code owners March 24, 2026 02:24
@product-auto-label product-auto-label Bot added the size: l Pull request size is large. label Mar 24, 2026
@vverman vverman force-pushed the refactor-x509-provider branch from 1500bea to f78ed98 Compare March 24, 2026 03:02
@vverman vverman requested a review from lqiu96 March 24, 2026 03:04
Comment thread oauth2_http/java/com/google/auth/mtls/MtlsUtils.java
Comment thread oauth2_http/java/com/google/auth/mtls/MtlsUtils.java
Comment thread oauth2_http/java/com/google/auth/mtls/X509Provider.java
Comment thread oauth2_http/java/com/google/auth/mtls/X509Provider.java
Comment thread oauth2_http/java/com/google/auth/mtls/X509Provider.java
Comment thread oauth2_http/java/com/google/auth/oauth2/PropertyProvider.java
*
* <p>For internal use only.
*/
public class SystemEnvironmentProvider implements EnvironmentProvider, Serializable {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

qq, what is the difference between SystemEnvironmentProvider and EnvironmentProvider?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

An EnvProvider is an interface which can be implemented by test-classes to pass in their own env variables.

The SystemEnvProvider implements this EnvProvider and implements the associated functions such that the env-variables are fetched from the system env.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Got it. Can you add @internalapi to this class and for SystemPropertyProvider?

Comment thread oauth2_http/java/com/google/auth/oauth2/SystemPropertyProvider.java
Comment thread oauth2_http/java/com/google/auth/mtls/MtlsUtils.java Outdated
@lqiu96

lqiu96 commented Mar 24, 2026

Copy link
Copy Markdown
Member

feat: Refactor x509Provider

Since this is a refactor, I'm going to change the title to chore: ... to reflect the type of change in the release notes. Thank you for helping with our backlog!

@lqiu96 lqiu96 changed the title feat: Refactor x509Provider chore: Refactor x509Provider to create a shared Utils class for Mtls Mar 24, 2026
@marcosgtz7

marcosgtz7 commented Mar 24, 2026 via email

Copy link
Copy Markdown

Comment thread oauth2_http/java/com/google/auth/oauth2/SystemPropertyProvider.java
Comment thread oauth2_http/java/com/google/auth/mtls/MtlsUtils.java Outdated
Comment thread oauth2_http/java/com/google/auth/mtls/MtlsUtils.java Outdated
Comment thread oauth2_http/javatests/com/google/auth/oauth2/TestPropertyProvider.java Outdated
Comment thread oauth2_http/java/com/google/auth/oauth2/PropertyProvider.java Outdated
Comment thread oauth2_http/java/com/google/auth/oauth2/SystemPropertyProvider.java Outdated
Comment thread oauth2_http/java/com/google/auth/oauth2/EnvironmentProvider.java
Comment thread oauth2_http/java/com/google/auth/oauth2/IdentityPoolCredentials.java Outdated
private static String getExplicitCertConfigPath(IdentityPoolCredentialSource credentialSource) {
IdentityPoolCredentialSource.CertificateConfig certConfig =
credentialSource.getCertificateConfig();
return certConfig.useDefaultCertificateConfig()

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.

Potential null pointer access: The variable certConfig may be null at this location

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Thanks for the catch! I added a null pointer check!

Comment thread oauth2_http/java/com/google/auth/mtls/MtlsUtils.java
Comment thread oauth2_http/javatests/com/google/auth/mtls/X509ProviderTest.java
@product-auto-label product-auto-label Bot added size: xl Pull request size is extra large. and removed size: l Pull request size is large. labels Apr 4, 2026
@vverman vverman force-pushed the refactor-x509-provider branch from b2ff241 to e8fbea7 Compare April 4, 2026 23:50
@vverman vverman requested a review from nbayati April 4, 2026 23:54
@lqiu96

lqiu96 commented Apr 6, 2026

Copy link
Copy Markdown
Member

When this gets merged into main, I'll port this over to the monorepo.

@product-auto-label product-auto-label Bot added the size: l Pull request size is large. label Apr 7, 2026
@product-auto-label product-auto-label Bot added size: xl Pull request size is extra large. and removed size: xl Pull request size is extra large. size: l Pull request size is large. labels Apr 7, 2026
@lqiu96

lqiu96 commented Apr 8, 2026

Copy link
Copy Markdown
Member

There is also new changes with the GraalVM job. Update with main should resolve that graalvm failure.

@vverman vverman force-pushed the refactor-x509-provider branch 2 times, most recently from 4ae0a81 to 356d7dc Compare April 8, 2026 19:19
@vverman vverman merged commit 77c85a9 into googleapis:main Apr 8, 2026
22 of 23 checks passed
lqiu96 pushed a commit to googleapis/google-cloud-java that referenced this pull request Apr 8, 2026
…1907)

* feat: Refactor X509Provider

* Added back accidentally removed tests.

* Lint fixes

* Addressed the PR comments.

* Test for windows OS cert default path

* lint fixes.

* Added Copyright headers.

* Addressed comments.

* Test fix.

* Added separate test class for mTLS-utils. Added missing cert and malformed cert tests to X509Provider.

* Lint fix.

Original-PR: googleapis/google-auth-library-java#1907
lqiu96 pushed a commit to googleapis/google-cloud-java that referenced this pull request Apr 13, 2026
…1907)

* feat: Refactor X509Provider

* Added back accidentally removed tests.

* Lint fixes

* Addressed the PR comments.

* Test for windows OS cert default path

* lint fixes.

* Added Copyright headers.

* Addressed comments.

* Test fix.

* Added separate test class for mTLS-utils. Added missing cert and malformed cert tests to X509Provider.

* Lint fix.

Original-PR: googleapis/google-auth-library-java#1907
Neenu1995 pushed a commit to googleapis/google-cloud-java that referenced this pull request Apr 17, 2026
…1907)

* feat: Refactor X509Provider

* Added back accidentally removed tests.

* Lint fixes

* Addressed the PR comments.

* Test for windows OS cert default path

* lint fixes.

* Added Copyright headers.

* Addressed comments.

* Test fix.

* Added separate test class for mTLS-utils. Added missing cert and malformed cert tests to X509Provider.

* Lint fix.

Original-PR: googleapis/google-auth-library-java#1907
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

size: xl Pull request size is extra large.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[google-auth-library-java] Auth: Refactor X509Provider

4 participants