This is an automated email from the ASF dual-hosted git repository.

emaynard pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/polaris.git


The following commit(s) were added to refs/heads/main by this push:
     new 6e416a9e9 Add IMPLICIT authentication support to the CLI (#2121)
6e416a9e9 is described below

commit 6e416a9e9e1b14027220c65f886efd0fd29a670d
Author: Pooja Nilangekar <poo...@umd.edu>
AuthorDate: Thu Jul 17 12:28:31 2025 -0400

    Add IMPLICIT authentication support to the CLI (#2121)
    
    PRs #1925 and #1912 were merged around the same time.  This PR connects the 
two changes and enables the CLI to accept IMPLICIT authentication type.
    
    Since Hadoop federated catalogs rely purely on IMPLICIT authentication, the 
CLI parsing test has been updated to reflect the same.
---
 client/python/cli/command/catalogs.py  | 12 +++++++++--
 client/python/cli/constants.py         |  3 ++-
 client/python/test/test_cli_parsing.py | 38 +++++++++++++++++++---------------
 3 files changed, 33 insertions(+), 20 deletions(-)

diff --git a/client/python/cli/command/catalogs.py 
b/client/python/cli/command/catalogs.py
index 501e9eefb..432ae1cab 100644
--- a/client/python/cli/command/catalogs.py
+++ b/client/python/cli/command/catalogs.py
@@ -27,7 +27,7 @@ from cli.constants import StorageType, CatalogType, 
CatalogConnectionType, Subco
 from cli.options.option_tree import Argument
 from polaris.management import PolarisDefaultApi, CreateCatalogRequest, 
UpdateCatalogRequest, \
     StorageConfigInfo, ExternalCatalog, AwsStorageConfigInfo, 
AzureStorageConfigInfo, GcpStorageConfigInfo, \
-    PolarisCatalog, CatalogProperties, BearerAuthenticationParameters, \
+    PolarisCatalog, CatalogProperties, BearerAuthenticationParameters, 
ImplicitAuthenticationParameters, \
     OAuthClientCredentialsParameters, SigV4AuthenticationParameters, 
HadoopConnectionConfigInfo, \
     IcebergRestConnectionConfigInfo, AwsIamServiceIdentityInfo
 
@@ -107,7 +107,11 @@ class CatalogsCommand(Command):
                         raise Exception(f"Authentication type 'SIGV4 requires"
                                 f" 
{Argument.to_flag_name(Arguments.CATALOG_ROLE_ARN)}"
                                 f" and 
{Argument.to_flag_name(Arguments.CATALOG_SIGNING_REGION)}")
-
+                if self.catalog_connection_type == 
CatalogConnectionType.HADOOP.value:
+                    if not self.hadoop_warehouse or not self.catalog_uri:
+                        raise Exception(f"Missing required argument for 
connection type 'HADOOP':"
+                                f" 
{Argument.to_flag_name(Arguments.HADOOP_WAREHOUSE)}"
+                                f" and 
{Argument.to_flag_name(Arguments.CATALOG_URI)}") 
         if self.catalog_service_identity_type == 
ServiceIdentityType.AWS_IAM.value:
             if not self.catalog_service_identity_iam_arn:
                         raise Exception(f"Missing required argument for 
service identity type 'AWS_IAM':"
@@ -224,6 +228,10 @@ class CatalogsCommand(Command):
                 signing_region=self.catalog_signing_region,
                 signing_name=self.catalog_signing_name,
             )
+        elif self.catalog_authentication_type == 
AuthenticationType.IMPLICIT.value:
+            auth_params = ImplicitAuthenticationParameters(
+                authentication_type=self.catalog_authentication_type.upper()
+            )
         elif self.catalog_authentication_type is not None:
             raise Exception("Unknown authentication type:", 
self.catalog_authentication_type)
 
diff --git a/client/python/cli/constants.py b/client/python/cli/constants.py
index 93b36d998..6b92c4d90 100644
--- a/client/python/cli/constants.py
+++ b/client/python/cli/constants.py
@@ -65,6 +65,7 @@ class AuthenticationType(Enum):
     OAUTH = "oauth"
     BEARER = "bearer"
     SIGV4 = "sigv4"
+    IMPLICIT = "implicit"
 
 
 class ServiceIdentityType(Enum):
@@ -241,7 +242,7 @@ class Hints:
                 "The type of external catalog in [ICEBERG, HADOOP]."
             )
             CATALOG_AUTHENTICATION_TYPE = (
-                "The type of authentication in [OAUTH, BEARER, SIGV4]"
+                "The type of authentication in [OAUTH, BEARER, SIGV4, 
IMPLICIT]"
             )
             CATALOG_SERVICE_IDENTITY_TYPE = "The type of service identity in 
[AWS_IAM]"
 
diff --git a/client/python/test/test_cli_parsing.py 
b/client/python/test/test_cli_parsing.py
index 715e2e3af..916cfe3ee 100644
--- a/client/python/test/test_cli_parsing.py
+++ b/client/python/test/test_cli_parsing.py
@@ -504,19 +504,6 @@ class TestCliParsing(unittest.TestCase):
                 (2, 'grant.namespace'): ['a', 'b', 'c'],
                 (2, 'grant.view_name'): 'v',
             })
-        check_arguments(
-            mock_execute(['catalogs', 'create', 'my-catalog', '--type', 
'external',
-                          '--storage-type', 'gcs', '--default-base-location', 
'dbl',
-                          '--catalog-connection-type', 'hadoop', 
'--hadoop-warehouse', 'h',
-                          '--catalog-uri', 'u', 
'--catalog-authentication-type', 'bearer',
-                          '--catalog-bearer-token', 'b']),
-            'create_catalog', {
-                (0, 'catalog.name'): 'my-catalog',
-                (0, 'catalog.type'): 'EXTERNAL',
-                (0, 'catalog.connection_config_info.connection_type'): 
'HADOOP',
-                (0, 'catalog.connection_config_info.warehouse'): 'h',
-                (0, 'catalog.connection_config_info.uri'): 'u',
-            })
         check_arguments(
             mock_execute(['catalogs', 'create', 'my-catalog', '--type', 
'external',
                           '--storage-type', 'gcs', '--default-base-location', 
'dbl',
@@ -533,20 +520,24 @@ class TestCliParsing(unittest.TestCase):
         check_arguments(
             mock_execute(['catalogs', 'create', 'my-catalog', '--type', 
'external',
                           '--storage-type', 'gcs', '--default-base-location', 
'dbl',
-                          '--catalog-connection-type', 'hadoop', 
'--hadoop-warehouse', 'h',
-                          '--catalog-authentication-type', 'oauth',
+                          '--catalog-connection-type', 'iceberg-rest',
+                          '--iceberg-remote-catalog-name', 'c',
+                          '--catalog-uri', 'u', 
'--catalog-authentication-type', 'oauth',
                           '--catalog-token-uri', 'u', '--catalog-client-id', 
'i',
                           '--catalog-client-secret', 'k', 
'--catalog-client-scope', 's1',
                           '--catalog-client-scope', 's2']),
             'create_catalog', {
                 (0, 'catalog.name'): 'my-catalog',
                 (0, 'catalog.type'): 'EXTERNAL',
-                (0, 'catalog.connection_config_info.connection_type'): 
'HADOOP',
-                (0, 'catalog.connection_config_info.warehouse'): 'h',
+                (0, 'catalog.connection_config_info.connection_type'): 
'ICEBERG_REST',
+                (0, 'catalog.connection_config_info.remote_catalog_name'): 'c',
+                (0, 'catalog.connection_config_info.uri'): 'u',
                 (0, 
'catalog.connection_config_info.authentication_parameters.authentication_type'):
 'OAUTH',
                 (0, 
'catalog.connection_config_info.authentication_parameters.token_uri'): 'u',
                 (0, 
'catalog.connection_config_info.authentication_parameters.client_id'): 'i',
                 (0, 
'catalog.connection_config_info.authentication_parameters.scopes'): ['s1', 
's2'],
+                (0, 'catalog.storage_config_info.storage_type'): 'GCS',
+                (0, 'catalog.properties.default_base_location'): 'dbl',
             })
         check_arguments(
             mock_execute(['catalogs', 'create', 'my-catalog', '--type', 
'external',
@@ -583,6 +574,19 @@ class TestCliParsing(unittest.TestCase):
                 (0, 
'catalog.connection_config_info.authentication_parameters.external_id'): 'i',
                 (0, 
'catalog.connection_config_info.authentication_parameters.signing_name'): 'g',
             })
+        check_arguments(
+            mock_execute(['catalogs', 'create', 'my-catalog', '--type', 
'external',
+                          '--storage-type', 'file', '--default-base-location', 
'dbl',
+                          '--catalog-connection-type', 'hadoop', 
'--hadoop-warehouse', 'h',
+                          '--catalog-authentication-type', 'implicit', 
'--catalog-uri', 'u']),
+            'create_catalog', {
+                (0, 'catalog.name'): 'my-catalog',
+                (0, 'catalog.type'): 'EXTERNAL',
+                (0, 'catalog.connection_config_info.connection_type'): 
'HADOOP',
+                (0, 'catalog.connection_config_info.warehouse'): 'h',
+                (0, 
'catalog.connection_config_info.authentication_parameters.authentication_type'):
 'IMPLICIT',
+                (0, 'catalog.connection_config_info.uri'): 'u',
+            })
 
 
 if __name__ == '__main__':

Reply via email to