public class TokenUtil extends Object
Modifier and Type | Field and Description |
---|---|
static String |
KEY_NAME_PREFIX |
Constructor and Description |
---|
TokenUtil() |
Modifier and Type | Method and Description |
---|---|
static void |
addTokenForJob(org.elasticsearch.hadoop.rest.RestClient client,
org.elasticsearch.hadoop.util.ClusterName clusterName,
User user,
Job job)
Retrieves an authentication token from the given user, obtaining a new token if necessary,
and adds it to the credentials for the given map reduce job.
|
static void |
addTokenForJobConf(org.elasticsearch.hadoop.rest.RestClient client,
org.elasticsearch.hadoop.util.ClusterName clusterName,
User user,
JobConf job)
Retrieves an authentication token from the given user, obtaining a new token if necessary,
and adds it to the credentials for the given map reduce job configuration.
|
static void |
obtainAndCache(org.elasticsearch.hadoop.rest.RestClient client,
User user)
Obtain an authentication token for the given user and add it to the
user's credentials.
|
static Token<EsTokenIdentifier> |
obtainToken(org.elasticsearch.hadoop.rest.RestClient client,
User user)
Obtain and return an authentication token for the current user.
|
static void |
obtainTokenForJob(org.elasticsearch.hadoop.rest.RestClient client,
User user,
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.elasticsearch.hadoop.rest.RestClient client,
User user,
JobConf jobConf)
Obtain an authentication token on behalf of the given user and add it to
the credentials for the given map reduce job.
|
public static final String KEY_NAME_PREFIX
public static Token<EsTokenIdentifier> obtainToken(org.elasticsearch.hadoop.rest.RestClient client, User user)
client
- The Elasticsearch clientpublic static void obtainAndCache(org.elasticsearch.hadoop.rest.RestClient client, User user) throws IOException
client
- The Elasticsearch clientuser
- The user for obtaining and storing the tokenIOException
- If making a remote call to the authentication service failspublic static void obtainTokenForJob(org.elasticsearch.hadoop.rest.RestClient client, User user, Job job)
client
- The Elasticsearch clientuser
- The user for whom to obtain the tokenjob
- The job instance in which the token should be storedpublic static void obtainTokenForJob(org.elasticsearch.hadoop.rest.RestClient client, User user, JobConf jobConf)
client
- The Elasticsearch clientuser
- The user for whom to obtain the tokenjobConf
- The job configuration in which the token should be storedpublic static void addTokenForJob(org.elasticsearch.hadoop.rest.RestClient client, org.elasticsearch.hadoop.util.ClusterName clusterName, User user, Job job)
client
- The Elasticsearch clientclusterName
- the name of the cluster you are connecting touser
- The user for whom to obtain the tokenjob
- The job instance in which the token should be storedIOException
- If making a remote call failsInterruptedException
- If executing as the given user is interruptedpublic static void addTokenForJobConf(org.elasticsearch.hadoop.rest.RestClient client, org.elasticsearch.hadoop.util.ClusterName clusterName, User user, JobConf job)
client
- The Elasticsearch clientclusterName
- the name of the cluster you are connecting touser
- The user for whom to obtain the tokenjob
- The job instance in which the token should be storedIOException
- If making a remote call failsInterruptedException
- If executing as the given user is interrupted