Search in sources :

Example 1 with DrillProperties

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();
}
Also used : HadoopKerberosName(org.apache.hadoop.security.HadoopKerberosName) DrillProperties(org.apache.drill.common.config.DrillProperties) UserGroupInformation(org.apache.hadoop.security.UserGroupInformation)

Aggregations

DrillProperties (org.apache.drill.common.config.DrillProperties)1 HadoopKerberosName (org.apache.hadoop.security.HadoopKerberosName)1 UserGroupInformation (org.apache.hadoop.security.UserGroupInformation)1