Credentials (Hadoop 0.20.2+737 API)
Date: 2010-10-11

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.security
Class Credentials

    java.lang.Object
      org.apache.hadoop.security.Credentials

All Implemented Interfaces:
  Writable

    public class Credentials

extends Object
implements Writable

A class that provides the facilities of reading and writing secret keys and Tokens.

Constructor Summary
`Credentials()`

Method Summary
`void` | `addAll(Credentials other)` Copy all of the credentials from one credential object into another.
`void` | `addSecretKey(Text alias, byte[] key)` Set the key for an alias
`void` | `addToken(Text alias, Token<? extends TokenIdentifier> t)` Add a token in the storage (in memory)
`Collection<Token<? extends TokenIdentifier>>` | `getAllTokens()` Return all the tokens in the in-memory map
`byte[]` | `getSecretKey(Text alias)` Returns the key bytes for the alias
`Token<? extends TokenIdentifier>` | `getToken(Text alias)` Returns the Token object for the alias
`int` | `numberOfSecretKeys()`
`int` | `numberOfTokens()`
`void` | `readFields(DataInput in)` Loads all the keys
`static Credentials` | `readTokenStorageFile(Path filename, Configuration conf)` Convenience method for reading a token storage file, and loading the Tokens therein in the passed UGI
`static Credentials` | `readTokenStorageFiles(String paths, Configuration conf)`
`void` | `readTokenStorageStream(DataInputStream in)` Convenience method for reading a token storage file directly from a datainputstream
`void` | `write(DataOutput out)` Stores all the keys to DataOutput
`void` | `writeTokenStorageFile(Path filename, Configuration conf)`
`void` | `writeTokenStorageToStream(DataOutputStream os)`

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

Constructor Detail

### Credentials

    public Credentials()

Method Detail

### getSecretKey

    public byte[] getSecretKey(Text alias)

  Returns the key bytes for the alias

  Parameters:
    `alias` - the alias for the key
  Returns:
    key for this alias

### getToken

    public Token<? extends TokenIdentifier> getToken(Text alias)

  Returns the Token object for the alias

  Parameters:
    `alias` - the alias for the Token
  Returns:
    token for this alias

### addToken

    public void addToken(Text alias,
                         Token<? extends TokenIdentifier> t)

  Add a token in the storage (in memory)

  Parameters:
    `alias` - the alias for the key
    `t` - the token object

### getAllTokens

    public Collection<Token<? extends TokenIdentifier>> getAllTokens()

  Return all the tokens in the in-memory map

### numberOfTokens

    public int numberOfTokens()

  Returns:
    number of Tokens in the in-memory map

### numberOfSecretKeys

    public int numberOfSecretKeys()

  Returns:
    number of keys in the in-memory map

### addSecretKey

    public void addSecretKey(Text alias,
                             byte[] key)

  Set the key for an alias

  Parameters:
    `alias` - the alias for the key
    `key` - the key bytes

### readTokenStorageFiles

    public static Credentials readTokenStorageFiles(String paths,
                                                    Configuration conf)
                                             throws IOException

  Throws:
    `IOException`

### readTokenStorageFile

    public static Credentials readTokenStorageFile(Path filename,
                                                   Configuration conf)
                                            throws IOException

  Convenience method for reading a token storage file, and loading the Tokens therein in the passed UGI

  Parameters:
    `filename` -
    `conf` -
  Throws:
    `IOException`

### readTokenStorageStream

    public void readTokenStorageStream(DataInputStream in)
                                throws IOException

  Convenience method for reading a token storage file directly from a datainputstream

  Throws:
    `IOException`

### writeTokenStorageToStream

    public void writeTokenStorageToStream(DataOutputStream os)
                                   throws IOException

  Throws:
    `IOException`

### writeTokenStorageFile

    public void writeTokenStorageFile(Path filename,
                                      Configuration conf)
                               throws IOException

  Throws:
    `IOException`

### write

    public void write(DataOutput out)
               throws IOException

  Stores all the keys to DataOutput

  Specified by:
    `write` in interface `Writable`
  Parameters:
    `out` -
  Throws:
    `IOException`

### readFields

    public void readFields(DataInput in)
                    throws IOException

  Loads all the keys

  Specified by:
    `readFields` in interface `Writable`
  Parameters:
    `in` -
  Throws:
    `IOException`

### addAll

    public void addAll(Credentials other)

  Copy all of the credentials from one credential object into another.

  Parameters:
    `other` - the credentials to copy

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