From 097aac1f911dcfe3ae32afee4aa634ab71fe9adb Mon Sep 17 00:00:00 2001 From: Yuya Ebihara Date: Wed, 16 Jul 2025 15:42:32 +0900 Subject: [PATCH] Core: Add 'google' auth type to auth manager --- .../org/apache/iceberg/rest/auth/AuthManagers.java | 3 +++ .../org/apache/iceberg/rest/auth/AuthProperties.java | 3 +++ .../iceberg/gcp/auth/TestGoogleAuthManager.java | 11 +++++++++++ 3 files changed, 17 insertions(+) diff --git a/core/src/main/java/org/apache/iceberg/rest/auth/AuthManagers.java b/core/src/main/java/org/apache/iceberg/rest/auth/AuthManagers.java index 331ee5268145..4e48118561f7 100644 --- a/core/src/main/java/org/apache/iceberg/rest/auth/AuthManagers.java +++ b/core/src/main/java/org/apache/iceberg/rest/auth/AuthManagers.java @@ -95,6 +95,9 @@ public static AuthManager loadAuthManager(String name, Map prope case AuthProperties.AUTH_TYPE_SIGV4: impl = AuthProperties.AUTH_MANAGER_IMPL_SIGV4; break; + case AuthProperties.AUTH_TYPE_GOOGLE: + impl = AuthProperties.AUTH_MANAGER_IMPL_GOOGLE; + break; case AuthProperties.AUTH_TYPE_OAUTH2: impl = AuthProperties.AUTH_MANAGER_IMPL_OAUTH2; break; diff --git a/core/src/main/java/org/apache/iceberg/rest/auth/AuthProperties.java b/core/src/main/java/org/apache/iceberg/rest/auth/AuthProperties.java index 65df6493a3e5..331c7a734a27 100644 --- a/core/src/main/java/org/apache/iceberg/rest/auth/AuthProperties.java +++ b/core/src/main/java/org/apache/iceberg/rest/auth/AuthProperties.java @@ -28,6 +28,7 @@ private AuthProperties() {} public static final String AUTH_TYPE_BASIC = "basic"; public static final String AUTH_TYPE_OAUTH2 = "oauth2"; public static final String AUTH_TYPE_SIGV4 = "sigv4"; + public static final String AUTH_TYPE_GOOGLE = "google"; public static final String AUTH_MANAGER_IMPL_NONE = "org.apache.iceberg.rest.auth.NoopAuthManager"; @@ -37,6 +38,8 @@ private AuthProperties() {} "org.apache.iceberg.rest.auth.OAuth2Manager"; public static final String AUTH_MANAGER_IMPL_SIGV4 = "org.apache.iceberg.aws.RESTSigV4AuthManager"; + public static final String AUTH_MANAGER_IMPL_GOOGLE = + "org.apache.iceberg.gcp.auth.GoogleAuthManager"; public static final String BASIC_USERNAME = "rest.auth.basic.username"; public static final String BASIC_PASSWORD = "rest.auth.basic.password"; diff --git a/gcp/src/test/java/org/apache/iceberg/gcp/auth/TestGoogleAuthManager.java b/gcp/src/test/java/org/apache/iceberg/gcp/auth/TestGoogleAuthManager.java index 834cfbf92532..63bc4cc7e77e 100644 --- a/gcp/src/test/java/org/apache/iceberg/gcp/auth/TestGoogleAuthManager.java +++ b/gcp/src/test/java/org/apache/iceberg/gcp/auth/TestGoogleAuthManager.java @@ -40,6 +40,9 @@ import org.apache.iceberg.relocated.com.google.common.collect.ImmutableList; import org.apache.iceberg.relocated.com.google.common.collect.ImmutableMap; import org.apache.iceberg.rest.RESTClient; +import org.apache.iceberg.rest.auth.AuthManager; +import org.apache.iceberg.rest.auth.AuthManagers; +import org.apache.iceberg.rest.auth.AuthProperties; import org.apache.iceberg.rest.auth.AuthSession; import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.BeforeEach; @@ -190,4 +193,12 @@ public void initSessionDelegatesToCatalogSession() { assertThat(resultSession).isSameAs(mockSession); verify(spyManager).catalogSession(restClient, props); } + + @Test + public void testLoadAuthManager() { + AuthManager manager = + AuthManagers.loadAuthManager( + "test", Map.of(AuthProperties.AUTH_TYPE, AuthProperties.AUTH_TYPE_GOOGLE)); + assertThat(manager).isInstanceOf(GoogleAuthManager.class); + } }