From 865c728a692fd1a688bc83e9e90ab5d50d82d592 Mon Sep 17 00:00:00 2001 From: Lawrence Qiu Date: Mon, 29 Jun 2026 20:57:40 +0000 Subject: [PATCH] refactor(auth): use @InternalApi annotation instead of comments --- .../google/auth/mtls/DefaultMtlsProviderFactory.java | 5 ++--- .../com/google/auth/mtls/SecureConnectProvider.java | 6 +++--- .../java/com/google/auth/mtls/X509Provider.java | 4 +--- .../java/com/google/auth/oauth2/OAuth2Utils.java | 10 +--------- 4 files changed, 7 insertions(+), 18 deletions(-) diff --git a/google-auth-library-java/oauth2_http/java/com/google/auth/mtls/DefaultMtlsProviderFactory.java b/google-auth-library-java/oauth2_http/java/com/google/auth/mtls/DefaultMtlsProviderFactory.java index b57accd4c224..08a9795a8377 100644 --- a/google-auth-library-java/oauth2_http/java/com/google/auth/mtls/DefaultMtlsProviderFactory.java +++ b/google-auth-library-java/oauth2_http/java/com/google/auth/mtls/DefaultMtlsProviderFactory.java @@ -30,8 +30,10 @@ package com.google.auth.mtls; +import com.google.api.core.InternalApi; import java.io.IOException; +@InternalApi public class DefaultMtlsProviderFactory { /** @@ -40,9 +42,6 @@ public class DefaultMtlsProviderFactory { * creating a {@link SecureConnectProvider}. If the secure connect provider also fails, it throws * a {@link com.google.auth.mtls.CertificateSourceUnavailableException}. * - *

This is only meant to be used internally by Google Cloud libraries, and the public facing - * methods may be changed without notice, and have no guarantee of backwards compatibility. - * * @return an instance of {@link MtlsProvider}. * @throws com.google.auth.mtls.CertificateSourceUnavailableException if neither provider can be * created. diff --git a/google-auth-library-java/oauth2_http/java/com/google/auth/mtls/SecureConnectProvider.java b/google-auth-library-java/oauth2_http/java/com/google/auth/mtls/SecureConnectProvider.java index 9d30d6800afe..7c13dd16ced6 100644 --- a/google-auth-library-java/oauth2_http/java/com/google/auth/mtls/SecureConnectProvider.java +++ b/google-auth-library-java/oauth2_http/java/com/google/auth/mtls/SecureConnectProvider.java @@ -33,6 +33,7 @@ import com.google.api.client.json.JsonParser; import com.google.api.client.json.gson.GsonFactory; import com.google.api.client.util.SecurityUtils; +import com.google.api.core.InternalApi; import com.google.common.annotations.VisibleForTesting; import com.google.common.collect.ImmutableList; import java.io.FileInputStream; @@ -46,9 +47,7 @@ /** * This class implements {@link MtlsProvider} for the Google Auth library transport layer via {@link - * ContextAwareMetadataJson}. This is only meant to be used internally by Google Cloud libraries, - * and the public facing methods may be changed without notice, and have no guarantee of backwards - * compatibility. + * ContextAwareMetadataJson}. * *

Note: This implementation is derived from the existing "MtlsProvider" found in the Gax * library, with two notable differences: 1) All logic associated with parsing environment variables @@ -60,6 +59,7 @@ *

Additionally, this implementation will replace the existing "MtlsProvider" in the Gax library. * The Gax library version of MtlsProvider will be marked as deprecated. */ +@InternalApi public class SecureConnectProvider implements MtlsProvider { interface ProcessProvider { public Process createProcess(InputStream metadata) throws IOException; diff --git a/google-auth-library-java/oauth2_http/java/com/google/auth/mtls/X509Provider.java b/google-auth-library-java/oauth2_http/java/com/google/auth/mtls/X509Provider.java index 4127b1492460..c87398940538 100644 --- a/google-auth-library-java/oauth2_http/java/com/google/auth/mtls/X509Provider.java +++ b/google-auth-library-java/oauth2_http/java/com/google/auth/mtls/X509Provider.java @@ -45,9 +45,7 @@ /** * This class implements {@link MtlsProvider} for the Google Auth library transport layer via {@link - * WorkloadCertificateConfiguration}. This is only meant to be used internally by Google Cloud - * libraries, and the public facing methods may be changed without notice, and have no guarantee of - * backwards compatibility. + * WorkloadCertificateConfiguration}. */ @InternalApi public class X509Provider implements MtlsProvider { diff --git a/google-auth-library-java/oauth2_http/java/com/google/auth/oauth2/OAuth2Utils.java b/google-auth-library-java/oauth2_http/java/com/google/auth/oauth2/OAuth2Utils.java index 643c3dc7dc65..2d5b18d7f67d 100644 --- a/google-auth-library-java/oauth2_http/java/com/google/auth/oauth2/OAuth2Utils.java +++ b/google-auth-library-java/oauth2_http/java/com/google/auth/oauth2/OAuth2Utils.java @@ -69,15 +69,7 @@ import java.util.Map; import java.util.Set; -/** - * Internal utilities for the com.google.auth.oauth2 namespace. - * - *

These classes are marked public but should be treated effectively as internal classes only. - * They are not subject to any backwards compatibility guarantees and might change or be removed at - * any time. They are provided only as a convenience for other libraries within the {@code - * com.google.auth} family. Application developers should avoid using these classes directly; they - * are not part of the public API. - */ +/** Internal utilities for the com.google.auth.oauth2 namespace. */ @InternalApi public class OAuth2Utils {