diff --git a/google-auth-library-java/credentials/java/com/google/auth/ApiKeyCredentials.java b/google-auth-library-java/credentials/java/com/google/auth/ApiKeyCredentials.java index 98c9ce551032..133de948e4ec 100644 --- a/google-auth-library-java/credentials/java/com/google/auth/ApiKeyCredentials.java +++ b/google-auth-library-java/credentials/java/com/google/auth/ApiKeyCredentials.java @@ -114,7 +114,7 @@ public boolean hasRequestMetadataOnly() { return true; } - /** There is no concept of refreshing an API tokens, this method is a no-op. */ + /** There is no concept of refreshing an API key, so this method is a no-op. */ @Override public void refresh() throws IOException {} } diff --git a/google-auth-library-java/credentials/java/com/google/auth/Retryable.java b/google-auth-library-java/credentials/java/com/google/auth/Retryable.java index 5aa4fcbbcbbb..d48c1fea5e55 100644 --- a/google-auth-library-java/credentials/java/com/google/auth/Retryable.java +++ b/google-auth-library-java/credentials/java/com/google/auth/Retryable.java @@ -33,7 +33,10 @@ import org.jspecify.annotations.NullMarked; -// an interface to identify retryable errors +/** + * Interface implemented by authentication exceptions that report whether the underlying failure is + * retryable and how many retry attempts were performed. + */ @NullMarked public interface Retryable { /** diff --git a/google-auth-library-java/oauth2_http/java/com/google/auth/http/AuthHttpConstants.java b/google-auth-library-java/oauth2_http/java/com/google/auth/http/AuthHttpConstants.java index 987224bd5442..1612692d6b05 100644 --- a/google-auth-library-java/oauth2_http/java/com/google/auth/http/AuthHttpConstants.java +++ b/google-auth-library-java/oauth2_http/java/com/google/auth/http/AuthHttpConstants.java @@ -39,6 +39,6 @@ public class AuthHttpConstants { /** HTTP "Bearer" authentication scheme */ public static final String BEARER = "Bearer"; - /** HTTP "Authentication" header */ + /** HTTP "Authorization" header */ public static final String AUTHORIZATION = "Authorization"; } 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 7b9b824d5e87..1ceaaba4ce04 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 @@ -34,6 +34,14 @@ import java.io.IOException; import org.jspecify.annotations.NullMarked; +/** + * Internal API. This class is public only due to Java's visibility settings. Direct use by + * customers is not recommended, as it may be updated without any backwards compatibility + * guarantees. + * + *
Factory for creating the default {@link MtlsProvider} from available client certificate
+ * sources.
+ */
@NullMarked
@InternalApi
public class DefaultMtlsProviderFactory {
diff --git a/google-auth-library-java/oauth2_http/java/com/google/auth/oauth2/DefaultCredentialsProvider.java b/google-auth-library-java/oauth2_http/java/com/google/auth/oauth2/DefaultCredentialsProvider.java
index a763326a870c..97042e67c6bb 100644
--- a/google-auth-library-java/oauth2_http/java/com/google/auth/oauth2/DefaultCredentialsProvider.java
+++ b/google-auth-library-java/oauth2_http/java/com/google/auth/oauth2/DefaultCredentialsProvider.java
@@ -281,7 +281,7 @@ private boolean runningOnAppEngine() {
}
throw new RuntimeException(
String.format(
- "Unexpected error trying to determine if runnning on Google App Engine: %s",
+ "Unexpected error trying to determine if running on Google App Engine: %s",
cause.getMessage()),
cause);
}
diff --git a/google-auth-library-java/oauth2_http/java/com/google/auth/oauth2/ExternalAccountCredentials.java b/google-auth-library-java/oauth2_http/java/com/google/auth/oauth2/ExternalAccountCredentials.java
index de329a4e0e7f..0fee4c663de8 100644
--- a/google-auth-library-java/oauth2_http/java/com/google/auth/oauth2/ExternalAccountCredentials.java
+++ b/google-auth-library-java/oauth2_http/java/com/google/auth/oauth2/ExternalAccountCredentials.java
@@ -112,7 +112,7 @@ public abstract class ExternalAccountCredentials extends GoogleCredentials {
* token exchange spec. Indicates the type of the security token in the credential file
* @param tokenUrl the Security Token Service token exchange endpoint
* @param tokenInfoUrl the endpoint used to retrieve account related information. Required for
- * gCloud session account identification.
+ * gcloud session account identification.
* @param credentialSource the external credential source
* @param serviceAccountImpersonationUrl the URL for the service account impersonation request.
* This URL is required for some APIs. If this URL is not available, the access token from the
@@ -160,7 +160,7 @@ protected ExternalAccountCredentials(
* token exchange spec. Indicates the type of the security token in the credential file
* @param tokenUrl the Security Token Service token exchange endpoint
* @param tokenInfoUrl the endpoint used to retrieve account related information. Required for
- * gCloud session account identification.
+ * gcloud session account identification.
* @param credentialSource the external credential source
* @param serviceAccountImpersonationUrl the URL for the service account impersonation request.
* This URL is required for some APIs. If this URL is not available, the access token from the
@@ -359,7 +359,8 @@ public Map Returns {@link IdentityPoolCredentials} or {@link AwsCredentials}.
+ * Returns {@link IdentityPoolCredentials}, {@link AwsCredentials}, or {@link
+ * PluggableAuthCredentials}.
*
* Important: If you accept a credential configuration (credential JSON/File/Stream) from an
* external source for authentication to Google Cloud Platform, you must validate it before
@@ -380,7 +381,8 @@ public static ExternalAccountCredentials fromStream(InputStream credentialsStrea
/**
* Returns credentials defined by a JSON file stream.
*
- * Returns a {@link IdentityPoolCredentials} or {@link AwsCredentials}.
+ * Returns {@link IdentityPoolCredentials}, {@link AwsCredentials}, or {@link
+ * PluggableAuthCredentials}.
*
* Important: If you accept a credential configuration (credential JSON/File/Stream) from an
* external source for authentication to Google Cloud Platform, you must validate it before
@@ -416,7 +418,7 @@ public static ExternalAccountCredentials fromStream(
}
/**
- * Returns external account credentials defined by JSON using the format generated by gCloud.
+ * Returns external account credentials defined by JSON using the format generated by gcloud.
*
* Important: If you accept a credential configuration (credential JSON/File/Stream) from an
* external source for authentication to Google Cloud Platform, you must validate it before
@@ -932,7 +934,7 @@ public Builder setServiceAccountImpersonationUrl(
}
/**
- * Sets the optional endpoint used to retrieve account related information. Required for gCloud
+ * Sets the optional endpoint used to retrieve account related information. Required for gcloud
* session account identification.
*
* @param tokenInfoUrl the token info url to set
diff --git a/google-auth-library-java/oauth2_http/java/com/google/auth/oauth2/GdchCredentials.java b/google-auth-library-java/oauth2_http/java/com/google/auth/oauth2/GdchCredentials.java
index 19362961ffe9..3ad40800c8e7 100644
--- a/google-auth-library-java/oauth2_http/java/com/google/auth/oauth2/GdchCredentials.java
+++ b/google-auth-library-java/oauth2_http/java/com/google/auth/oauth2/GdchCredentials.java
@@ -82,6 +82,12 @@
import org.jspecify.annotations.NullMarked;
import org.jspecify.annotations.Nullable;
+/**
+ * OAuth2 credentials for Google Distributed Cloud Hosted (GDCH) service accounts.
+ *
+ * Exchanges a locally signed ES256 JWT assertion with the configured GDCH token server to obtain
+ * short-lived access tokens for a target API audience.
+ */
@NullMarked
public class GdchCredentials extends GoogleCredentials {
private static final LoggerProvider LOGGER_PROVIDER =
@@ -137,8 +143,7 @@ public class GdchCredentials extends GoogleCredentials {
}
/**
- * Returns credentials defined by a GdchCredentials key file in JSON format from the Google
- * Developers Console.
+ * Returns credentials defined by a GDCH service account key file in JSON format.
*
* Important: If you accept a credential configuration (credential JSON/File/Stream) from an
* external source for authentication to Google Cloud Platform, you must validate it before
@@ -156,8 +161,7 @@ public static GdchCredentials fromStream(InputStream credentialsStream) throws I
}
/**
- * Returns credentials defined by a GdchCredentials key file in JSON format from the Google
- * Developers Console.
+ * Returns credentials defined by a GDCH service account key file in JSON format.
*
* Important: If you accept a credential configuration (credential JSON/File/Stream) from an
* external source for authentication to Google Cloud Platform, you must validate it before
diff --git a/google-auth-library-java/oauth2_http/java/com/google/auth/oauth2/GoogleAuthException.java b/google-auth-library-java/oauth2_http/java/com/google/auth/oauth2/GoogleAuthException.java
index bfb36fa90a45..d74b7e148c96 100644
--- a/google-auth-library-java/oauth2_http/java/com/google/auth/oauth2/GoogleAuthException.java
+++ b/google-auth-library-java/oauth2_http/java/com/google/auth/oauth2/GoogleAuthException.java
@@ -113,7 +113,7 @@ class GoogleAuthException extends IOException implements Retryable {
* Creates an instance of the exception based on {@link HttpResponseException} and a custom error
* message.
*
- * @see #createWithTokenEndpointResponseException(HttpResponseException, String)
+ * @see #createWithTokenEndpointResponseException(HttpResponseException)
* @param responseException an instance of {@link HttpResponseException}
* @param message The detail message (which is saved for later retrieval by the {@link
* #getMessage()} method)
@@ -167,11 +167,11 @@ static GoogleAuthException createWithTokenEndpointIOException(
}
/**
- * Creates an instance of the exception based on {@link IOException} returned by Google token
- * endpoint. It uses response status code information to populate the {@code #isRetryable}
- * property and a number of performed attempts to populate the {@code #retryCount} property
+ * Creates an instance of the exception based on an {@link IOException} thrown while calling the
+ * Google token endpoint. Marks the exception as retryable ({@link #isRetryable()} returns {@code
+ * true}) and sets {@link #getRetryCount()} to the default token endpoint retry count.
*
- * @see #createWithTokenEndpointIOException(IOException)
+ * @see #createWithTokenEndpointIOException(IOException, String)
* @param ioException an instance of {@link IOException}
* @return new instance of {@link GoogleAuthException}
*/
@@ -185,7 +185,7 @@ public boolean isRetryable() {
return isRetryable;
}
- /** Returns number of reties performed for the related HTTP request */
+ /** Returns number of retries performed for the related HTTP request */
@Override
public int getRetryCount() {
return retryCount;
diff --git a/google-auth-library-java/oauth2_http/java/com/google/auth/oauth2/GoogleCredentials.java b/google-auth-library-java/oauth2_http/java/com/google/auth/oauth2/GoogleCredentials.java
index 9d41e0811afe..4252f707b19b 100644
--- a/google-auth-library-java/oauth2_http/java/com/google/auth/oauth2/GoogleCredentials.java
+++ b/google-auth-library-java/oauth2_http/java/com/google/auth/oauth2/GoogleCredentials.java
@@ -168,6 +168,9 @@ public static GoogleCredentials create(@Nullable String universeDomain, AccessTo
*
* @return the credentials instance.
* @throws IOException if the credentials cannot be created in the current environment.
+ * @see Application
+ * Default Credentials search order
*/
public static GoogleCredentials getApplicationDefault() throws IOException {
return getApplicationDefault(OAuth2Utils.HTTP_TRANSPORT_FACTORY);
@@ -183,8 +186,12 @@ public static GoogleCredentials getApplicationDefault() throws IOException {
* Returns credentials defined by a JSON file stream.
*
- * The stream can contain a Service Account key file in JSON format from the Google Developers
- * Console or a stored user credential using the format supported by the Cloud SDK.
+ * The stream can contain a JSON credential configuration for any supported type: {@link
+ * ServiceAccountCredentials} ({@code service_account}), {@link UserCredentials} ({@code
+ * authorized_user}), {@link ExternalAccountCredentials} ({@code external_account}), {@link
+ * ExternalAccountAuthorizedUserCredentials} ({@code external_account_authorized_user}), {@link
+ * ImpersonatedCredentials} ({@code impersonated_service_account}), or {@link GdchCredentials}
+ * ({@code gdch_service_account}).
*
* @param credentialsStream the stream with the credential definition.
* @return the credential defined by the credentialsStream.
@@ -298,8 +312,12 @@ static String extractFromJson(Map Returns credentials defined by a JSON file stream.
*
- * The stream can contain a Service Account key file in JSON format from the Google Developers
- * Console or a stored user credential using the format supported by the Cloud SDK.
+ * The stream can contain a JSON credential configuration for any supported type: {@link
+ * ServiceAccountCredentials} ({@code service_account}), {@link UserCredentials} ({@code
+ * authorized_user}), {@link ExternalAccountCredentials} ({@code external_account}), {@link
+ * ExternalAccountAuthorizedUserCredentials} ({@code external_account_authorized_user}), {@link
+ * ImpersonatedCredentials} ({@code impersonated_service_account}), or {@link GdchCredentials}
+ * ({@code gdch_service_account}).
*
* @param credentialsStream the stream with the credential definition.
* @return the credential defined by the credentialsStream.
diff --git a/google-auth-library-java/oauth2_http/java/com/google/auth/oauth2/OAuth2Credentials.java b/google-auth-library-java/oauth2_http/java/com/google/auth/oauth2/OAuth2Credentials.java
index 180c76db206b..3646f75a45e9 100644
--- a/google-auth-library-java/oauth2_http/java/com/google/auth/oauth2/OAuth2Credentials.java
+++ b/google-auth-library-java/oauth2_http/java/com/google/auth/oauth2/OAuth2Credentials.java
@@ -433,7 +433,7 @@ public interface CredentialsChangedListener {
* This is typically used by code caching the access token.
*
* @param credentials The updated credentials instance
- * @throws IOException My be thrown by listeners if saving credentials fails.
+ * @throws IOException May be thrown by listeners if saving credentials fails.
*/
void onChanged(OAuth2Credentials credentials) throws IOException;
}
diff --git a/google-auth-library-java/oauth2_http/java/com/google/auth/oauth2/PKCEProvider.java b/google-auth-library-java/oauth2_http/java/com/google/auth/oauth2/PKCEProvider.java
index f54ec600cbfd..03fe722cc404 100644
--- a/google-auth-library-java/oauth2_http/java/com/google/auth/oauth2/PKCEProvider.java
+++ b/google-auth-library-java/oauth2_http/java/com/google/auth/oauth2/PKCEProvider.java
@@ -33,6 +33,11 @@
import org.jspecify.annotations.NullMarked;
+/**
+ * Provider of Proof Key for Code Exchange (PKCE) parameters ({@code code_verifier}, {@code
+ * code_challenge}, and {@code code_challenge_method}) for OAuth 2.0 authorization flows as defined
+ * in RFC 7636.
+ */
@NullMarked
public interface PKCEProvider {
/**
diff --git a/google-auth-library-java/oauth2_http/java/com/google/auth/oauth2/UserAuthorizer.java b/google-auth-library-java/oauth2_http/java/com/google/auth/oauth2/UserAuthorizer.java
index ed22e5e9b25d..025962b5cc64 100644
--- a/google-auth-library-java/oauth2_http/java/com/google/auth/oauth2/UserAuthorizer.java
+++ b/google-auth-library-java/oauth2_http/java/com/google/auth/oauth2/UserAuthorizer.java
@@ -122,7 +122,7 @@ private UserAuthorizer(Builder builder) {
}
/**
- * Returns the Client ID user to identify the OAuth2 consent prompt.
+ * Returns the Client ID used to identify the OAuth2 consent prompt.
*
* @return The Client ID.
*/
*
+ *
*