diff --git a/presto-docs/src/main/sphinx/connector/iceberg.rst b/presto-docs/src/main/sphinx/connector/iceberg.rst index 1acfaab6fe399..0411c9e0a0ecd 100644 --- a/presto-docs/src/main/sphinx/connector/iceberg.rst +++ b/presto-docs/src/main/sphinx/connector/iceberg.rst @@ -69,14 +69,8 @@ Property Name Description Example: ``https://localhost:19120/api/v1`` ``iceberg.nessie.auth.type`` The authentication type to use. - Available values are ``BASIC`` or ``BEARER``. - Example: ``BEARER`` - -``iceberg.nessie.auth.basic.username`` The username to use with ``BASIC`` authentication. - Example: ``test_user`` - -``iceberg.nessie.auth.basic.password`` The password to use with ``BASIC`` authentication. - Example: ``my$ecretPass`` + Available values are ``NONE`` or ``BEARER``. + Default: ``NONE`` ``iceberg.nessie.auth.bearer.token`` The token to use with ``BEARER`` authentication. Example: ``SXVLUXUhIExFQ0tFUiEK`` diff --git a/presto-iceberg/src/main/java/com/facebook/presto/iceberg/IcebergResourceFactory.java b/presto-iceberg/src/main/java/com/facebook/presto/iceberg/IcebergResourceFactory.java index 97f59d5e31bcb..bcb5bc14b2875 100644 --- a/presto-iceberg/src/main/java/com/facebook/presto/iceberg/IcebergResourceFactory.java +++ b/presto-iceberg/src/main/java/com/facebook/presto/iceberg/IcebergResourceFactory.java @@ -37,7 +37,6 @@ import static com.facebook.presto.iceberg.CatalogType.NESSIE; import static com.facebook.presto.iceberg.IcebergSessionProperties.getNessieReferenceHash; import static com.facebook.presto.iceberg.IcebergSessionProperties.getNessieReferenceName; -import static com.facebook.presto.iceberg.nessie.AuthenticationType.BASIC; import static com.facebook.presto.iceberg.nessie.AuthenticationType.BEARER; import static com.facebook.presto.spi.StandardErrorCode.NOT_SUPPORTED; import static com.google.common.base.Throwables.throwIfInstanceOf; @@ -165,13 +164,7 @@ public Map getCatalogProperties(ConnectorSession session) nessieConfig.getConnectTimeoutMillis().ifPresent(val -> properties.put("transport.connect-timeout", val.toString())); nessieConfig.getClientBuilderImpl().ifPresent(val -> properties.put("client-builder-impl", val)); nessieConfig.getAuthenticationType().ifPresent(type -> { - if (type == BASIC) { - properties.put("authentication.username", nessieConfig.getUsername() - .orElseThrow(() -> new IllegalStateException("iceberg.nessie.auth.basic.username must be set with BASIC authentication"))); - properties.put("authentication.password", nessieConfig.getPassword() - .orElseThrow(() -> new IllegalStateException("iceberg.nessie.auth.basic.password must be set with BASIC authentication"))); - } - else if (type == BEARER) { + if (type == BEARER) { properties.put("authentication.token", nessieConfig.getBearerToken() .orElseThrow(() -> new IllegalStateException("iceberg.nessie.auth.bearer.token must be set with BEARER authentication"))); } diff --git a/presto-iceberg/src/main/java/com/facebook/presto/iceberg/nessie/AuthenticationType.java b/presto-iceberg/src/main/java/com/facebook/presto/iceberg/nessie/AuthenticationType.java index 2e821cbf36243..1585bd6ce095a 100644 --- a/presto-iceberg/src/main/java/com/facebook/presto/iceberg/nessie/AuthenticationType.java +++ b/presto-iceberg/src/main/java/com/facebook/presto/iceberg/nessie/AuthenticationType.java @@ -15,6 +15,6 @@ public enum AuthenticationType { - BASIC, + NONE, BEARER } diff --git a/presto-iceberg/src/main/java/com/facebook/presto/iceberg/nessie/NessieConfig.java b/presto-iceberg/src/main/java/com/facebook/presto/iceberg/nessie/NessieConfig.java index 730711945357e..73c41c7244353 100644 --- a/presto-iceberg/src/main/java/com/facebook/presto/iceberg/nessie/NessieConfig.java +++ b/presto-iceberg/src/main/java/com/facebook/presto/iceberg/nessie/NessieConfig.java @@ -20,13 +20,13 @@ import java.util.Optional; +import static com.facebook.presto.iceberg.nessie.AuthenticationType.NONE; + public class NessieConfig { private String defaultReferenceName = "main"; private String serverUri; - private AuthenticationType authenticationType; - private String username; - private String password; + private AuthenticationType authenticationType = NONE; private String bearerToken; private Integer readTimeoutMillis; private Integer connectTimeoutMillis; @@ -61,7 +61,7 @@ public NessieConfig setServerUri(String serverUri) } @Config("iceberg.nessie.auth.type") - @ConfigDescription("The authentication type to use. Available values are BASIC | BEARER") + @ConfigDescription("The authentication type to use. Available values are NONE | BEARER") public NessieConfig setAuthenticationType(AuthenticationType authenticationType) { this.authenticationType = authenticationType; @@ -73,32 +73,6 @@ public Optional getAuthenticationType() return Optional.ofNullable(authenticationType); } - @Config("iceberg.nessie.auth.basic.username") - @ConfigDescription("The username to use with BASIC authentication") - public NessieConfig setUsername(String username) - { - this.username = username; - return this; - } - - public Optional getUsername() - { - return Optional.ofNullable(username); - } - - @Config("iceberg.nessie.auth.basic.password") - @ConfigDescription("The password to use with BASIC authentication") - public NessieConfig setPassword(String password) - { - this.password = password; - return this; - } - - public Optional getPassword() - { - return Optional.ofNullable(password); - } - @Config("iceberg.nessie.auth.bearer.token") @ConfigDescription("The token to use with BEARER authentication") public NessieConfig setBearerToken(String bearerToken) diff --git a/presto-iceberg/src/test/java/com/facebook/presto/iceberg/nessie/TestNessieConfig.java b/presto-iceberg/src/test/java/com/facebook/presto/iceberg/nessie/TestNessieConfig.java index f76bd1d8c1208..4f0fecdd8511d 100644 --- a/presto-iceberg/src/test/java/com/facebook/presto/iceberg/nessie/TestNessieConfig.java +++ b/presto-iceberg/src/test/java/com/facebook/presto/iceberg/nessie/TestNessieConfig.java @@ -21,6 +21,7 @@ import static com.facebook.airlift.configuration.testing.ConfigAssertions.assertFullMapping; import static com.facebook.airlift.configuration.testing.ConfigAssertions.assertRecordedDefaults; import static com.facebook.airlift.configuration.testing.ConfigAssertions.recordDefaults; +import static com.facebook.presto.iceberg.nessie.AuthenticationType.NONE; public class TestNessieConfig { @@ -29,16 +30,14 @@ public void testDefaults() { assertRecordedDefaults(recordDefaults(NessieConfig.class) .setClientBuilderImpl(null) - .setAuthenticationType(null) + .setAuthenticationType(NONE) .setBearerToken(null) .setCompressionEnabled(true) .setDefaultReferenceName("main") .setConnectTimeoutMillis(null) - .setPassword(null) .setReadTimeoutMillis(null) .setReadTimeoutMillis(null) - .setServerUri(null) - .setUsername(null)); + .setServerUri(null)); } @Test @@ -47,9 +46,7 @@ public void testExplicitPropertyMappings() Map properties = ImmutableMap.builder() .put("iceberg.nessie.uri", "http://localhost:xxx/api/v1") .put("iceberg.nessie.ref", "someRef") - .put("iceberg.nessie.auth.type", "BASIC") - .put("iceberg.nessie.auth.basic.username", "user") - .put("iceberg.nessie.auth.basic.password", "pass") + .put("iceberg.nessie.auth.type", "BEARER") .put("iceberg.nessie.auth.bearer.token", "bearerToken") .put("iceberg.nessie.compression-enabled", "false") .put("iceberg.nessie.connect-timeout-ms", "123") @@ -60,9 +57,7 @@ public void testExplicitPropertyMappings() NessieConfig expected = new NessieConfig() .setServerUri("http://localhost:xxx/api/v1") .setDefaultReferenceName("someRef") - .setAuthenticationType(AuthenticationType.BASIC) - .setUsername("user") - .setPassword("pass") + .setAuthenticationType(AuthenticationType.BEARER) .setBearerToken("bearerToken") .setCompressionEnabled(false) .setConnectTimeoutMillis(123)