use of org.apache.drill.common.config.DrillProperties in project drill by apache.
the class BitConnectionConfig method getSaslClientProperties.
public Map<String, ?> getSaslClientProperties(final DrillbitEndpoint remoteEndpoint, final Map<String, String> overrides) throws IOException {
final DrillProperties properties = DrillProperties.createEmpty();
final UserGroupInformation loginUser = UserGroupInformation.getLoginUser();
if (loginUser.getAuthenticationMethod() == UserGroupInformation.AuthenticationMethod.KERBEROS) {
final HadoopKerberosName loginPrincipal = new HadoopKerberosName(loginUser.getUserName());
if (!useLoginPrincipal) {
properties.setProperty(DrillProperties.SERVICE_PRINCIPAL, KerberosUtil.getPrincipalFromParts(loginPrincipal.getShortName(), remoteEndpoint.getAddress(), loginPrincipal.getRealm()));
} else {
properties.setProperty(DrillProperties.SERVICE_PRINCIPAL, loginPrincipal.toString());
}
}
properties.merge(overrides);
return properties.stringPropertiesAsMap();
}
Aggregations