Search in sources :

Example 1 with DelegationTokenIdentifier

use of org.apache.hadoop.hive.metastore.security.DelegationTokenIdentifier 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);
    }
}
Also used : DelegationTokenIdentifier(org.apache.hadoop.hive.metastore.security.DelegationTokenIdentifier) TUGIAssumingTransport(org.apache.hadoop.hive.thrift.client.TUGIAssumingTransport) Token(org.apache.hadoop.security.token.Token) TSaslClientTransport(org.apache.thrift.transport.TSaslClientTransport) UncheckedIOException(java.io.UncheckedIOException) TTransport(org.apache.thrift.transport.TTransport) IOException(java.io.IOException) UncheckedIOException(java.io.UncheckedIOException)

Example 2 with DelegationTokenIdentifier

use of org.apache.hadoop.hive.metastore.security.DelegationTokenIdentifier in project hive by apache.

the class SessionUtils method createToken.

/**
 * Create a new token using the given string and service
 *
 * @param tokenStr
 * @param tokenService
 * @return
 * @throws IOException
 */
private static Token<DelegationTokenIdentifier> createToken(String tokenStr, String tokenService) throws IOException {
    Token<DelegationTokenIdentifier> delegationToken = new Token<DelegationTokenIdentifier>();
    delegationToken.decodeFromUrlString(tokenStr);
    delegationToken.setService(new Text(tokenService));
    return delegationToken;
}
Also used : DelegationTokenIdentifier(org.apache.hadoop.hive.metastore.security.DelegationTokenIdentifier) Token(org.apache.hadoop.security.token.Token) Text(org.apache.hadoop.io.Text)

Example 3 with DelegationTokenIdentifier

use of org.apache.hadoop.hive.metastore.security.DelegationTokenIdentifier in project hive by apache.

the class SecurityUtils method createToken.

/**
 * Create a new token using the given string and service
 *
 * @param tokenStr
 * @param tokenService
 * @return
 * @throws IOException
 */
private static Token<DelegationTokenIdentifier> createToken(String tokenStr, String tokenService) throws IOException {
    Token<DelegationTokenIdentifier> delegationToken = new Token<DelegationTokenIdentifier>();
    delegationToken.decodeFromUrlString(tokenStr);
    delegationToken.setService(new Text(tokenService));
    return delegationToken;
}
Also used : DelegationTokenIdentifier(org.apache.hadoop.hive.metastore.security.DelegationTokenIdentifier) Token(org.apache.hadoop.security.token.Token) Text(org.apache.hadoop.io.Text)

Aggregations

DelegationTokenIdentifier (org.apache.hadoop.hive.metastore.security.DelegationTokenIdentifier)3 Token (org.apache.hadoop.security.token.Token)3 Text (org.apache.hadoop.io.Text)2 IOException (java.io.IOException)1 UncheckedIOException (java.io.UncheckedIOException)1 TUGIAssumingTransport (org.apache.hadoop.hive.thrift.client.TUGIAssumingTransport)1 TSaslClientTransport (org.apache.thrift.transport.TSaslClientTransport)1 TTransport (org.apache.thrift.transport.TTransport)1