org.apache.hadoop.hbase.security.token
Class TokenUtil

java.lang.Object
  extended by org.apache.hadoop.hbase.security.token.TokenUtil

@InterfaceAudience.Public
@InterfaceStability.Evolving
public class TokenUtil
extends Object

Utility methods for obtaining authentication tokens.


Constructor Summary
TokenUtil()
           
 
Method Summary
static void addTokenForJob(HConnection conn, org.apache.hadoop.mapred.JobConf job, User user)
          Checks for an authentication token for the given user, obtaining a new token if necessary, and adds it to the credentials for the given map reduce job.
static void addTokenForJob(HConnection conn, User user, org.apache.hadoop.mapreduce.Job job)
          Checks for an authentication token for the given user, obtaining a new token if necessary, and adds it to the credentials for the given map reduce job.
static boolean addTokenIfMissing(HConnection conn, User user)
          Checks if an authentication tokens exists for the connected cluster, obtaining one if needed and adding it to the user's credentials.
static void obtainAndCacheToken(org.apache.hadoop.conf.Configuration conf, org.apache.hadoop.security.UserGroupInformation user)
          Deprecated. Replaced by obtainAndCacheToken(HConnection,User)
static void obtainAndCacheToken(HConnection conn, User user)
          Obtain an authentication token for the given user and add it to the user's credentials.
static org.apache.hadoop.security.token.Token<AuthenticationTokenIdentifier> obtainToken(org.apache.hadoop.conf.Configuration conf)
          Deprecated. Replaced by obtainToken(HConnection)
static org.apache.hadoop.security.token.Token<AuthenticationTokenIdentifier> obtainToken(HConnection conn)
          Obtain and return an authentication token for the current user.
static org.apache.hadoop.security.token.Token<AuthenticationTokenIdentifier> obtainToken(HConnection conn, User user)
          Obtain and return an authentication token for the current user.
static void obtainTokenForJob(org.apache.hadoop.conf.Configuration conf, org.apache.hadoop.security.UserGroupInformation user, org.apache.hadoop.mapreduce.Job job)
          Deprecated. Replaced by obtainTokenForJob(HConnection,User,Job)
static void obtainTokenForJob(HConnection conn, org.apache.hadoop.mapred.JobConf job, User user)
          Obtain an authentication token on behalf of the given user and add it to the credentials for the given map reduce job.
static void obtainTokenForJob(HConnection conn, User user, org.apache.hadoop.mapreduce.Job job)
          Obtain an authentication token on behalf of the given user and add it to the credentials for the given map reduce job.
static void obtainTokenForJob(org.apache.hadoop.mapred.JobConf job, org.apache.hadoop.security.UserGroupInformation user)
          Deprecated. Replaced by obtainTokenForJob(HConnection,JobConf,User)
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TokenUtil

public TokenUtil()
Method Detail

obtainToken

@Deprecated
public static org.apache.hadoop.security.token.Token<AuthenticationTokenIdentifier> obtainToken(org.apache.hadoop.conf.Configuration conf)
                                                                                         throws IOException
Deprecated. Replaced by obtainToken(HConnection)

Obtain and return an authentication token for the current user.

Parameters:
conf - the configuration for connecting to the cluster
Returns:
the authentication token instance
Throws:
IOException

obtainToken

public static org.apache.hadoop.security.token.Token<AuthenticationTokenIdentifier> obtainToken(HConnection conn)
                                                                                         throws IOException
Obtain and return an authentication token for the current user.

Parameters:
conn - The HBase cluster connection
Returns:
the authentication token instance
Throws:
IOException

obtainToken

public static org.apache.hadoop.security.token.Token<AuthenticationTokenIdentifier> obtainToken(HConnection conn,
                                                                                                User user)
                                                                                         throws IOException,
                                                                                                InterruptedException
Obtain and return an authentication token for the current user.

Parameters:
conn - The HBase cluster connection
Returns:
the authentication token instance
Throws:
IOException
InterruptedException

obtainAndCacheToken

@Deprecated
public static void obtainAndCacheToken(org.apache.hadoop.conf.Configuration conf,
                                                  org.apache.hadoop.security.UserGroupInformation user)
                                throws IOException,
                                       InterruptedException
Deprecated. Replaced by obtainAndCacheToken(HConnection,User)

Obtain an authentication token for the given user and add it to the user's credentials.

Parameters:
conf - The configuration for connecting to the cluster
user - The user for whom to obtain the token
Throws:
IOException - If making a remote call to the authentication service fails
InterruptedException - If executing as the given user is interrupted

obtainAndCacheToken

public static void obtainAndCacheToken(HConnection conn,
                                       User user)
                                throws IOException,
                                       InterruptedException
Obtain an authentication token for the given user and add it to the user's credentials.

Parameters:
conn - The HBase cluster connection
user - The user for whom to obtain the token
Throws:
IOException - If making a remote call to the authentication service fails
InterruptedException - If executing as the given user is interrupted

obtainTokenForJob

@Deprecated
public static void obtainTokenForJob(org.apache.hadoop.conf.Configuration conf,
                                                org.apache.hadoop.security.UserGroupInformation user,
                                                org.apache.hadoop.mapreduce.Job job)
                              throws IOException,
                                     InterruptedException
Deprecated. Replaced by obtainTokenForJob(HConnection,User,Job)

Obtain an authentication token on behalf of the given user and add it to the credentials for the given map reduce job.

Parameters:
conf - The configuration for connecting to the cluster
user - The user for whom to obtain the token
job - The job instance in which the token should be stored
Throws:
IOException - If making a remote call to the authentication service fails
InterruptedException - If executing as the given user is interrupted

obtainTokenForJob

public static void obtainTokenForJob(HConnection conn,
                                     User user,
                                     org.apache.hadoop.mapreduce.Job job)
                              throws IOException,
                                     InterruptedException
Obtain an authentication token on behalf of the given user and add it to the credentials for the given map reduce job.

Parameters:
conn - The HBase cluster connection
user - The user for whom to obtain the token
job - The job instance in which the token should be stored
Throws:
IOException - If making a remote call to the authentication service fails
InterruptedException - If executing as the given user is interrupted

obtainTokenForJob

@Deprecated
public static void obtainTokenForJob(org.apache.hadoop.mapred.JobConf job,
                                                org.apache.hadoop.security.UserGroupInformation user)
                              throws IOException,
                                     InterruptedException
Deprecated. Replaced by obtainTokenForJob(HConnection,JobConf,User)

Obtain an authentication token on behalf of the given user and add it to the credentials for the given map reduce job.

Parameters:
user - The user for whom to obtain the token
job - The job configuration in which the token should be stored
Throws:
IOException - If making a remote call to the authentication service fails
InterruptedException - If executing as the given user is interrupted

obtainTokenForJob

public static void obtainTokenForJob(HConnection conn,
                                     org.apache.hadoop.mapred.JobConf job,
                                     User user)
                              throws IOException,
                                     InterruptedException
Obtain an authentication token on behalf of the given user and add it to the credentials for the given map reduce job.

Parameters:
conn - The HBase cluster connection
user - The user for whom to obtain the token
job - The job configuration in which the token should be stored
Throws:
IOException - If making a remote call to the authentication service fails
InterruptedException - If executing as the given user is interrupted

addTokenForJob

public static void addTokenForJob(HConnection conn,
                                  org.apache.hadoop.mapred.JobConf job,
                                  User user)
                           throws IOException,
                                  InterruptedException
Checks for an authentication token for the given user, obtaining a new token if necessary, and adds it to the credentials for the given map reduce job.

Parameters:
conn - The HBase cluster connection
user - The user for whom to obtain the token
job - The job configuration in which the token should be stored
Throws:
IOException - If making a remote call to the authentication service fails
InterruptedException - If executing as the given user is interrupted

addTokenForJob

public static void addTokenForJob(HConnection conn,
                                  User user,
                                  org.apache.hadoop.mapreduce.Job job)
                           throws IOException,
                                  InterruptedException
Checks for an authentication token for the given user, obtaining a new token if necessary, and adds it to the credentials for the given map reduce job.

Parameters:
conn - The HBase cluster connection
user - The user for whom to obtain the token
job - The job instance in which the token should be stored
Throws:
IOException - If making a remote call to the authentication service fails
InterruptedException - If executing as the given user is interrupted

addTokenIfMissing

public static boolean addTokenIfMissing(HConnection conn,
                                        User user)
                                 throws IOException,
                                        InterruptedException
Checks if an authentication tokens exists for the connected cluster, obtaining one if needed and adding it to the user's credentials.

Parameters:
conn - The HBase cluster connection
user - The user for whom to obtain the token
Returns:
true if the token was added, false if it already existed
Throws:
IOException - If making a remote call to the authentication service fails
InterruptedException - If executing as the given user is interrupted


Copyright © 2015 The Apache Software Foundation. All Rights Reserved.