Skip to content

Commit aca6f2a

Browse files
authored
Core: Add 'google' auth type to auth manager (#13564)
1 parent 9922e6d commit aca6f2a

3 files changed

Lines changed: 17 additions & 0 deletions

File tree

core/src/main/java/org/apache/iceberg/rest/auth/AuthManagers.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,9 @@ public static AuthManager loadAuthManager(String name, Map<String, String> prope
9595
case AuthProperties.AUTH_TYPE_SIGV4:
9696
impl = AuthProperties.AUTH_MANAGER_IMPL_SIGV4;
9797
break;
98+
case AuthProperties.AUTH_TYPE_GOOGLE:
99+
impl = AuthProperties.AUTH_MANAGER_IMPL_GOOGLE;
100+
break;
98101
case AuthProperties.AUTH_TYPE_OAUTH2:
99102
impl = AuthProperties.AUTH_MANAGER_IMPL_OAUTH2;
100103
break;

core/src/main/java/org/apache/iceberg/rest/auth/AuthProperties.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ private AuthProperties() {}
2828
public static final String AUTH_TYPE_BASIC = "basic";
2929
public static final String AUTH_TYPE_OAUTH2 = "oauth2";
3030
public static final String AUTH_TYPE_SIGV4 = "sigv4";
31+
public static final String AUTH_TYPE_GOOGLE = "google";
3132

3233
public static final String AUTH_MANAGER_IMPL_NONE =
3334
"org.apache.iceberg.rest.auth.NoopAuthManager";
@@ -37,6 +38,8 @@ private AuthProperties() {}
3738
"org.apache.iceberg.rest.auth.OAuth2Manager";
3839
public static final String AUTH_MANAGER_IMPL_SIGV4 =
3940
"org.apache.iceberg.aws.RESTSigV4AuthManager";
41+
public static final String AUTH_MANAGER_IMPL_GOOGLE =
42+
"org.apache.iceberg.gcp.auth.GoogleAuthManager";
4043

4144
public static final String BASIC_USERNAME = "rest.auth.basic.username";
4245
public static final String BASIC_PASSWORD = "rest.auth.basic.password";

gcp/src/test/java/org/apache/iceberg/gcp/auth/TestGoogleAuthManager.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,9 @@
4040
import org.apache.iceberg.relocated.com.google.common.collect.ImmutableList;
4141
import org.apache.iceberg.relocated.com.google.common.collect.ImmutableMap;
4242
import org.apache.iceberg.rest.RESTClient;
43+
import org.apache.iceberg.rest.auth.AuthManager;
44+
import org.apache.iceberg.rest.auth.AuthManagers;
45+
import org.apache.iceberg.rest.auth.AuthProperties;
4346
import org.apache.iceberg.rest.auth.AuthSession;
4447
import org.junit.jupiter.api.AfterEach;
4548
import org.junit.jupiter.api.BeforeEach;
@@ -190,4 +193,12 @@ public void initSessionDelegatesToCatalogSession() {
190193
assertThat(resultSession).isSameAs(mockSession);
191194
verify(spyManager).catalogSession(restClient, props);
192195
}
196+
197+
@Test
198+
public void testLoadAuthManager() {
199+
AuthManager manager =
200+
AuthManagers.loadAuthManager(
201+
"test", Map.of(AuthProperties.AUTH_TYPE, AuthProperties.AUTH_TYPE_GOOGLE));
202+
assertThat(manager).isInstanceOf(GoogleAuthManager.class);
203+
}
193204
}

0 commit comments

Comments
 (0)