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(java.lang.String jobId,
org.apache.hadoop.security.token.Token<JobTokenIdentifier> token)
Add the job token of a job to cache
|
static byte[] |
computeHash(byte[] msg,
javax.crypto.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 javax.crypto.SecretKey |
createSecretKey(byte[] key)
Convert the byte[] to a secret key
|
void |
removeTokenForJob(java.lang.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.
|
javax.crypto.SecretKey |
retrieveTokenSecret(java.lang.String jobId)
Look up the token password/secret for the given jobId.
|
public static javax.crypto.SecretKey createSecretKey(byte[] key)
key
- the byte[] to create the secret key frompublic static byte[] computeHash(byte[] msg, javax.crypto.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(java.lang.String jobId, org.apache.hadoop.security.token.Token<JobTokenIdentifier> token)
jobId
- the job that owns the tokentoken
- the job tokenpublic void removeTokenForJob(java.lang.String jobId)
jobId
- the job whose token is to be removedpublic javax.crypto.SecretKey retrieveTokenSecret(java.lang.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 © 2009 The Apache Software Foundation