JobTokenSecretManager (Hadoop 1.2.1 API)
Date: 2013-07-22

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.apache.hadoop.mapreduce.security.token
Class JobTokenSecretManager

    java.lang.Object
      org.apache.hadoop.security.token.SecretManager<JobTokenIdentifier>
          org.apache.hadoop.mapreduce.security.token.JobTokenSecretManager

    public class JobTokenSecretManager

extends SecretManager<JobTokenIdentifier>

SecretManager for job token. It can be used to cache generated job tokens.

Nested Class Summary

Nested classes/interfaces inherited from class org.apache.hadoop.security.token.SecretManager
`SecretManager.InvalidToken`

Constructor Summary
`JobTokenSecretManager()` Default constructor

Method Summary
`void` | `addTokenForJob(String jobId, 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.

Methods inherited from class org.apache.hadoop.security.token.SecretManager
`createPassword, generateSecret`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### JobTokenSecretManager

    public JobTokenSecretManager()

  Default constructor

Method Detail

### createSecretKey

    public static SecretKey createSecretKey(byte[] key)

  Convert the byte[] to a secret key

  Parameters:
    `key` - the byte[] to create the secret key from
  Returns:
    the secret key

### computeHash

    public static byte[] computeHash(byte[] msg,
                                     SecretKey key)

  Compute the HMAC hash of the message using the key

  Parameters:
    `msg` - the message to hash
    `key` - the key to use
  Returns:
    the computed hash

### createPassword

    public byte[] createPassword(JobTokenIdentifier identifier)

  Create a new password/secret for the given job token identifier.

  Specified by:
    `createPassword` in class `SecretManager<JobTokenIdentifier>`
  Parameters:
    `identifier` - the job token identifier
  Returns:
    token password/secret

### addTokenForJob

    public void addTokenForJob(String jobId,
                               Token<JobTokenIdentifier> token)

  Add the job token of a job to cache

  Parameters:
    `jobId` - the job that owns the token
    `token` - the job token

### removeTokenForJob

    public void removeTokenForJob(String jobId)

  Remove the cached job token of a job from cache

  Parameters:
    `jobId` - the job whose token is to be removed

### retrieveTokenSecret

    public SecretKey retrieveTokenSecret(String jobId)
                                  throws SecretManager.InvalidToken

  Look up the token password/secret for the given jobId.

  Parameters:
    `jobId` - the jobId to look up
  Returns:
    token password/secret as SecretKey
  Throws:
    `InvalidToken`
    `SecretManager.InvalidToken`

### retrievePassword

    public byte[] retrievePassword(JobTokenIdentifier identifier)
                            throws SecretManager.InvalidToken

  Look up the token password/secret for the given job token identifier.

  Specified by:
    `retrievePassword` in class `SecretManager<JobTokenIdentifier>`
  Parameters:
    `identifier` - the job token identifier to look up
  Returns:
    token password/secret as byte[]
  Throws:
    `InvalidToken`
    `SecretManager.InvalidToken`

### createIdentifier

    public JobTokenIdentifier createIdentifier()

  Create an empty job token identifier

  Specified by:
    `createIdentifier` in class `SecretManager<JobTokenIdentifier>`
  Returns:
    a newly created empty job token identifier

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2009 The Apache Software Foundation