Refactored Accumulo client authentication properties (#508)
diff --git a/src/main/java/org/apache/accumulo/proxy/Proxy.java b/src/main/java/org/apache/accumulo/proxy/Proxy.java
index de817f9..a00d635 100644
--- a/src/main/java/org/apache/accumulo/proxy/Proxy.java
+++ b/src/main/java/org/apache/accumulo/proxy/Proxy.java
@@ -25,6 +25,7 @@
import org.apache.accumulo.core.cli.Help;
import org.apache.accumulo.core.client.impl.ClientConfConverter;
+import org.apache.accumulo.core.client.security.tokens.AuthenticationToken;
import org.apache.accumulo.core.client.security.tokens.KerberosToken;
import org.apache.accumulo.core.conf.ClientProperty;
import org.apache.accumulo.core.conf.ConfigurationTypeHelper;
@@ -243,8 +244,13 @@
}
// Login via principal and keytab
- final String kerberosPrincipal = ClientProperty.AUTH_USERNAME.getValue(props);
- final String kerberosKeytab = ClientProperty.AUTH_KERBEROS_KEYTAB_PATH.getValue(props);
+ final String kerberosPrincipal = ClientProperty.AUTH_PRINCIPAL.getValue(props);
+ final AuthenticationToken authToken = ClientProperty.getAuthenticationToken(props);
+ if (!(authToken instanceof KerberosToken)) {
+ throw new IllegalStateException("Kerberos authentication must be used with SASL");
+ }
+ final KerberosToken kerberosToken = (KerberosToken) authToken;
+ final String kerberosKeytab = kerberosToken.getKeytab().getAbsolutePath();
if (StringUtils.isBlank(kerberosPrincipal) || StringUtils.isBlank(kerberosKeytab)) {
throw new IllegalStateException(
String.format("Kerberos principal '%s' and keytab '%s'" + " must be provided",