@InterfaceAudience.Public public class TokenUtil extends Object
Constructor and Description |
---|
TokenUtil() |
Modifier and Type | Method and Description |
---|---|
static void |
addTokenForJob(Connection 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(Connection 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(Connection 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(Connection 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(Connection conn)
Obtain and return an authentication token for the current user.
|
static org.apache.hadoop.security.token.Token<AuthenticationTokenIdentifier> |
obtainToken(Connection conn,
User user)
Obtain and return an authentication token for the current user.
|
static void |
obtainTokenForJob(Connection 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(Connection 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 org.apache.hadoop.security.token.Token<AuthenticationTokenIdentifier> |
toToken(AuthenticationProtos.Token proto)
Converts a protobuf Token message back into a Token instance.
|
static AuthenticationProtos.Token |
toToken(org.apache.hadoop.security.token.Token<AuthenticationTokenIdentifier> token)
Converts a Token instance (with embedded identifier) to the protobuf representation.
|
public static org.apache.hadoop.security.token.Token<AuthenticationTokenIdentifier> obtainToken(Connection conn) throws IOException
conn
- The HBase cluster connectionIOException
- if a remote error or serialization problem occurs.public static AuthenticationProtos.Token toToken(org.apache.hadoop.security.token.Token<AuthenticationTokenIdentifier> token)
token
- the Token instance to copypublic static org.apache.hadoop.security.token.Token<AuthenticationTokenIdentifier> obtainToken(Connection conn, User user) throws IOException, InterruptedException
conn
- The HBase cluster connectionIOException
InterruptedException
public static void obtainAndCacheToken(Connection conn, User user) throws IOException, InterruptedException
conn
- The HBase cluster connectionuser
- The user for whom to obtain the tokenIOException
- If making a remote call to the authentication service failsInterruptedException
- If executing as the given user is interruptedpublic static void obtainTokenForJob(Connection conn, User user, org.apache.hadoop.mapreduce.Job job) throws IOException, InterruptedException
conn
- The HBase cluster connectionuser
- The user for whom to obtain the tokenjob
- The job instance in which the token should be storedIOException
- If making a remote call to the authentication service failsInterruptedException
- If executing as the given user is interruptedpublic static void obtainTokenForJob(Connection conn, org.apache.hadoop.mapred.JobConf job, User user) throws IOException, InterruptedException
conn
- The HBase cluster connectionuser
- The user for whom to obtain the tokenjob
- The job configuration in which the token should be storedIOException
- If making a remote call to the authentication service failsInterruptedException
- If executing as the given user is interruptedpublic static void addTokenForJob(Connection conn, org.apache.hadoop.mapred.JobConf job, User user) throws IOException, InterruptedException
conn
- The HBase cluster connectionuser
- The user for whom to obtain the tokenjob
- The job configuration in which the token should be storedIOException
- If making a remote call to the authentication service failsInterruptedException
- If executing as the given user is interruptedpublic static void addTokenForJob(Connection conn, User user, org.apache.hadoop.mapreduce.Job job) throws IOException, InterruptedException
conn
- The HBase cluster connectionuser
- The user for whom to obtain the tokenjob
- The job instance in which the token should be storedIOException
- If making a remote call to the authentication service failsInterruptedException
- If executing as the given user is interruptedpublic static boolean addTokenIfMissing(Connection conn, User user) throws IOException, InterruptedException
conn
- The HBase cluster connectionuser
- The user for whom to obtain the tokenIOException
- If making a remote call to the authentication service failsInterruptedException
- If executing as the given user is interruptedpublic static org.apache.hadoop.security.token.Token<AuthenticationTokenIdentifier> toToken(AuthenticationProtos.Token proto)
proto
- the protobuf Token messageCopyright © 2007–2019 Cloudera. All rights reserved.