Package org.apache.hadoop.mapreduce.security
Class TokenCache
java.lang.Object
org.apache.hadoop.mapreduce.security.TokenCache
This class provides user facing APIs for transferring secrets from
the job client to the tasks.
The secrets can be stored just before submission of jobs and read during
the task execution.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidRemove jobtoken referrals which don't make sense in the context of the task execution.static Token<?>getDelegationToken(Credentials credentials, String namenode) Deprecated.static byte[]getEncryptedSpillKey(Credentials credentials) static Token<org.apache.hadoop.mapreduce.security.token.JobTokenIdentifier>getJobToken(Credentials credentials) static byte[]getSecretKey(Credentials credentials, Text alias) auxiliary method to get user's secret keys..static byte[]getShuffleSecretKey(Credentials credentials) static CredentialsloadTokens(String jobTokenFile, Configuration conf) Deprecated.UseCredentials.readTokenStorageFile(org.apache.hadoop.fs.Path, org.apache.hadoop.conf.Configuration)instead, this method is included for compatibility against Hadoop-1.static CredentialsDeprecated.UseCredentials.readTokenStorageFile(org.apache.hadoop.fs.Path, org.apache.hadoop.conf.Configuration)instead, this method is included for compatibility against Hadoop-1.static voidobtainTokensForNamenodes(Credentials credentials, Path[] ps, Configuration conf) Convenience method to obtain delegation tokens from namenodes corresponding to the paths passed.static voidsetEncryptedSpillKey(byte[] key, Credentials credentials) static voidsetJobToken(Token<? extends TokenIdentifier> t, Credentials credentials) store job tokenstatic voidsetShuffleSecretKey(byte[] key, Credentials credentials)
-
Field Details
-
JOB_TOKEN_HDFS_FILE
file name used on HDFS for generated job token- See Also:
-
JOB_TOKENS_FILENAME
conf setting for job tokens cache file name- See Also:
-
-
Constructor Details
-
TokenCache
public TokenCache()
-
-
Method Details
-
getSecretKey
auxiliary method to get user's secret keys..- Parameters:
alias-- Returns:
- secret key from the storage
-
obtainTokensForNamenodes
public static void obtainTokensForNamenodes(Credentials credentials, Path[] ps, Configuration conf) throws IOException Convenience method to obtain delegation tokens from namenodes corresponding to the paths passed.- Parameters:
credentials-ps- array of pathsconf- configuration- Throws:
IOException
-
cleanUpTokenReferral
Remove jobtoken referrals which don't make sense in the context of the task execution.- Parameters:
conf-
-
loadTokens
@Private @Deprecated public static Credentials loadTokens(String jobTokenFile, JobConf conf) throws IOException Deprecated.UseCredentials.readTokenStorageFile(org.apache.hadoop.fs.Path, org.apache.hadoop.conf.Configuration)instead, this method is included for compatibility against Hadoop-1.load job token from a file- Parameters:
conf-- Throws:
IOException
-
loadTokens
@Private @Deprecated public static Credentials loadTokens(String jobTokenFile, Configuration conf) throws IOException Deprecated.UseCredentials.readTokenStorageFile(org.apache.hadoop.fs.Path, org.apache.hadoop.conf.Configuration)instead, this method is included for compatibility against Hadoop-1.load job token from a file- Parameters:
conf-- Throws:
IOException
-
setJobToken
@Private public static void setJobToken(Token<? extends TokenIdentifier> t, Credentials credentials) store job token- Parameters:
t-
-
getJobToken
@Private public static Token<org.apache.hadoop.mapreduce.security.token.JobTokenIdentifier> getJobToken(Credentials credentials) - Returns:
- job token
-
setShuffleSecretKey
-
getShuffleSecretKey
-
setEncryptedSpillKey
-
getEncryptedSpillKey
-
getDelegationToken
@Private @Deprecated public static Token<?> getDelegationToken(Credentials credentials, String namenode) Deprecated.UseCredentials.getToken(org.apache.hadoop.io.Text)instead, this method is included for compatibility against Hadoop-1- Parameters:
namenode-- Returns:
- delegation token
-
Credentials.getToken(org.apache.hadoop.io.Text)instead, this method is included for compatibility against Hadoop-1