use of org.apache.hadoop.hive.thrift.client.TUGIAssumingTransport in project presto by prestodb.
the class KerberosHiveMetastoreAuthentication method authenticateWithToken.
private TTransport authenticateWithToken(TTransport rawTransport, String tokenString) {
try {
Token<DelegationTokenIdentifier> token = new Token<>();
token.decodeFromUrlString(tokenString);
TTransport saslTransport = new TSaslClientTransport(TOKEN.getMechanismName(), null, null, SASL_DEFAULT_REALM, SASL_PROPERTIES, new SaslClientCallbackHandler(token), rawTransport);
return new TUGIAssumingTransport(saslTransport, UserGroupInformation.getCurrentUser());
} catch (IOException ex) {
throw new UncheckedIOException(ex);
}
}
use of org.apache.hadoop.hive.thrift.client.TUGIAssumingTransport in project presto by prestodb.
the class KerberosHiveMetastoreAuthentication method authenticateWithHost.
private TTransport authenticateWithHost(TTransport rawTransport, String hiveMetastoreHost) {
try {
String serverPrincipal = getServerPrincipal(hiveMetastoreServicePrincipal, hiveMetastoreHost);
String[] names = SaslRpcServer.splitKerberosName(serverPrincipal);
checkState(names.length == 3, "Kerberos principal name does NOT have the expected hostname part: %s", serverPrincipal);
Map<String, String> saslProps = ImmutableMap.of(QOP, hdfsWireEncryptionEnabled ? "auth-conf" : "auth", SERVER_AUTH, "true");
TTransport saslTransport = new TSaslClientTransport(KERBEROS.getMechanismName(), null, names[0], names[1], saslProps, null, rawTransport);
return new TUGIAssumingTransport(saslTransport, authentication.getUserGroupInformation());
} catch (IOException e) {
throw new UncheckedIOException(e);
}
}
use of org.apache.hadoop.hive.thrift.client.TUGIAssumingTransport in project presto by prestodb.
the class KerberosHiveMetastoreAuthentication method authenticate.
@Override
public TTransport authenticate(TTransport rawTransport, String hiveMetastoreHost) throws TTransportException {
try {
String serverPrincipal = getServerPrincipal(hiveMetastoreServicePrincipal, hiveMetastoreHost);
String[] names = SaslRpcServer.splitKerberosName(serverPrincipal);
checkState(names.length == 3, "Kerberos principal name does NOT have the expected hostname part: %s", serverPrincipal);
Map<String, String> saslProps = ImmutableMap.of(Sasl.QOP, "auth", Sasl.SERVER_AUTH, "true");
TTransport saslTransport = new TSaslClientTransport(KERBEROS.getMechanismName(), null, names[0], names[1], saslProps, null, rawTransport);
return new TUGIAssumingTransport(saslTransport, authentication.getUserGroupInformation());
} catch (IOException e) {
throw Throwables.propagate(e);
}
}
Aggregations