@InterfaceAudience.Private @InterfaceStability.Unstable public class JobTokenSecretManager extends org.apache.hadoop.security.token.SecretManager<JobTokenIdentifier>
Constructor and Description |
---|
JobTokenSecretManager()
Default constructor
|
Modifier and Type | Method and Description |
---|---|
void |
addTokenForJob(String jobId,
org.apache.hadoop.security.token.Token<JobTokenIdentifier> token)
Add the job token of a job to cache
|
static byte[] |
computeHash(byte[] msg,
SecretKey key)
Compute the HMAC hash of the message using the key
|
JobTokenIdentifier |
createIdentifier()
Create an empty job token identifier
|
byte[] |
createPassword(JobTokenIdentifier identifier)
Create a new password/secret for the given job token identifier.
|
static SecretKey |
createSecretKey(byte[] key)
Convert the byte[] to a secret key
|
void |
removeTokenForJob(String jobId)
Remove the cached job token of a job from cache
|
byte[] |
retrievePassword(JobTokenIdentifier identifier)
Look up the token password/secret for the given job token identifier.
|
SecretKey |
retrieveTokenSecret(String jobId)
Look up the token password/secret for the given jobId.
|
public static SecretKey createSecretKey(byte[] key)
key
- the byte[] to create the secret key frompublic static byte[] computeHash(byte[] msg, SecretKey key)
msg
- the message to hashkey
- the key to usepublic byte[] createPassword(JobTokenIdentifier identifier)
createPassword
in class org.apache.hadoop.security.token.SecretManager<JobTokenIdentifier>
identifier
- the job token identifierpublic void addTokenForJob(String jobId, org.apache.hadoop.security.token.Token<JobTokenIdentifier> token)
jobId
- the job that owns the tokentoken
- the job tokenpublic void removeTokenForJob(String jobId)
jobId
- the job whose token is to be removedpublic SecretKey retrieveTokenSecret(String jobId) throws org.apache.hadoop.security.token.SecretManager.InvalidToken
jobId
- the jobId to look upInvalidToken
org.apache.hadoop.security.token.SecretManager.InvalidToken
public byte[] retrievePassword(JobTokenIdentifier identifier) throws org.apache.hadoop.security.token.SecretManager.InvalidToken
retrievePassword
in class org.apache.hadoop.security.token.SecretManager<JobTokenIdentifier>
identifier
- the job token identifier to look upInvalidToken
org.apache.hadoop.security.token.SecretManager.InvalidToken
public JobTokenIdentifier createIdentifier()
createIdentifier
in class org.apache.hadoop.security.token.SecretManager<JobTokenIdentifier>
Copyright © 2016 Apache Software Foundation. All Rights Reserved.