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

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


The following commit(s) were added to refs/heads/main by this push:
     new 2948fa3c2  [#4184] Improvement: Moved DEFAULT_IMPERSONATION_ENABLE 
from KerberosConfig to AuthenticationConfig (#4221)
2948fa3c2 is described below

commit 2948fa3c2f32bf0972f447acc4fe51469df52761
Author: Ashwin Kherde <[email protected]>
AuthorDate: Sun Jul 21 23:27:24 2024 -0400

     [#4184] Improvement: Moved DEFAULT_IMPERSONATION_ENABLE from 
KerberosConfig to AuthenticationConfig (#4221)
    
    ### What changes were proposed in this pull request?
    
    Enhancements to the utilization and placement of
    KerberosConfig.DEFAULT_IMPERSONATION_ENABLE
    
    ### Why are the changes needed?
    
    Referencing a member of a subclass during initialisation, may give
    unexpected results because the child class might not have been
    initialised yet.
    
    Fix: #4184
    
    ### Does this PR introduce _any_ user-facing change?
    
    No
    
    Let me know if you have any suggestions.
    
    ---------
    
    Co-authored-by: AKherde <[email protected]>
---
 .../catalog/hadoop/authentication/AuthenticationConfig.java        | 7 ++++---
 .../catalog/hadoop/authentication/kerberos/KerberosConfig.java     | 2 --
 2 files changed, 4 insertions(+), 5 deletions(-)

diff --git 
a/catalogs/catalog-hadoop/src/main/java/org/apache/gravitino/catalog/hadoop/authentication/AuthenticationConfig.java
 
b/catalogs/catalog-hadoop/src/main/java/org/apache/gravitino/catalog/hadoop/authentication/AuthenticationConfig.java
index ebf96196d..88e70ffdc 100644
--- 
a/catalogs/catalog-hadoop/src/main/java/org/apache/gravitino/catalog/hadoop/authentication/AuthenticationConfig.java
+++ 
b/catalogs/catalog-hadoop/src/main/java/org/apache/gravitino/catalog/hadoop/authentication/AuthenticationConfig.java
@@ -22,7 +22,6 @@ package org.apache.gravitino.catalog.hadoop.authentication;
 import com.google.common.collect.ImmutableMap;
 import java.util.Map;
 import org.apache.gravitino.Config;
-import 
org.apache.gravitino.catalog.hadoop.authentication.kerberos.KerberosConfig;
 import org.apache.gravitino.config.ConfigBuilder;
 import org.apache.gravitino.config.ConfigConstants;
 import org.apache.gravitino.config.ConfigEntry;
@@ -35,6 +34,8 @@ public class AuthenticationConfig extends Config {
 
   public static final String IMPERSONATION_ENABLE_KEY = 
"authentication.impersonation-enable";
 
+  public static final boolean KERBEROS_DEFAULT_IMPERSONATION_ENABLE = false;
+
   public AuthenticationConfig(Map<String, String> properties) {
     super(false);
     loadFromMap(properties, k -> true);
@@ -53,7 +54,7 @@ public class AuthenticationConfig extends Config {
           .doc("Whether to enable impersonation for the Hadoop catalog")
           .version(ConfigConstants.VERSION_0_5_1)
           .booleanConf()
-          .createWithDefault(KerberosConfig.DEFAULT_IMPERSONATION_ENABLE);
+          .createWithDefault(KERBEROS_DEFAULT_IMPERSONATION_ENABLE);
 
   public String getAuthType() {
     return get(AUTH_TYPE_ENTRY);
@@ -72,7 +73,7 @@ public class AuthenticationConfig extends Config {
                   "Whether to enable impersonation for the Hadoop catalog",
                   false,
                   true,
-                  KerberosConfig.DEFAULT_IMPERSONATION_ENABLE,
+                  KERBEROS_DEFAULT_IMPERSONATION_ENABLE,
                   false,
                   false))
           .put(
diff --git 
a/catalogs/catalog-hadoop/src/main/java/org/apache/gravitino/catalog/hadoop/authentication/kerberos/KerberosConfig.java
 
b/catalogs/catalog-hadoop/src/main/java/org/apache/gravitino/catalog/hadoop/authentication/kerberos/KerberosConfig.java
index a54067115..06ee946de 100644
--- 
a/catalogs/catalog-hadoop/src/main/java/org/apache/gravitino/catalog/hadoop/authentication/kerberos/KerberosConfig.java
+++ 
b/catalogs/catalog-hadoop/src/main/java/org/apache/gravitino/catalog/hadoop/authentication/kerberos/KerberosConfig.java
@@ -38,8 +38,6 @@ public class KerberosConfig extends AuthenticationConfig {
   public static final String FETCH_TIMEOUT_SEC_KEY =
       "authentication.kerberos.keytab-fetch-timeout-sec";
 
-  public static final boolean DEFAULT_IMPERSONATION_ENABLE = false;
-
   public static final ConfigEntry<String> PRINCIPAL_ENTRY =
       new ConfigBuilder(PRINCIPAL_KEY)
           .doc("The principal of the Kerberos connection")

Reply via email to