org.apache.hadoop.security.token
Class Token<T extends TokenIdentifier>

java.lang.Object
  extended by org.apache.hadoop.security.token.Token<T>
All Implemented Interfaces:
Writable

public class Token<T extends TokenIdentifier>
extends Object
implements Writable

The client-side form of the token.


Constructor Summary
Token()
          Default constructor
Token(byte[] identifier, byte[] password, Text kind, Text service)
          Construct a token from the components.
Token(T id, SecretManager<T> mgr)
          Construct a token given a token identifier and a secret manager for the type of the token identifier.
 
Method Summary
 void decodeFromUrlString(String newValue)
          Decode the given url safe string into this token.
 String encodeToUrlString()
          Encode this token as a url safe string
 boolean equals(Object right)
           
 byte[] getIdentifier()
          Get the token identifier
 Text getKind()
          Get the token kind
 byte[] getPassword()
          Get the token password/secret
 Text getService()
          Get the service on which the token is supposed to be used
 int hashCode()
           
 void readFields(DataInput in)
          Deserialize the fields of this object from in.
 void setService(Text newService)
          Set the service on which the token is supposed to be used
 String toString()
           
 void write(DataOutput out)
          Serialize the fields of this object to out.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Token

public Token(T id,
             SecretManager<T> mgr)
Construct a token given a token identifier and a secret manager for the type of the token identifier.

Parameters:
id - the token identifier
mgr - the secret manager

Token

public Token(byte[] identifier,
             byte[] password,
             Text kind,
             Text service)
Construct a token from the components.

Parameters:
identifier - the token identifier
password - the token's password
kind - the kind of token
service - the service for this token

Token

public Token()
Default constructor

Method Detail

getIdentifier

public byte[] getIdentifier()
Get the token identifier

Returns:
the token identifier

getPassword

public byte[] getPassword()
Get the token password/secret

Returns:
the token password/secret

getKind

public Text getKind()
Get the token kind

Returns:
the kind of the token

getService

public Text getService()
Get the service on which the token is supposed to be used

Returns:
the service name

setService

public void setService(Text newService)
Set the service on which the token is supposed to be used

Parameters:
newService - the service name

readFields

public void readFields(DataInput in)
                throws IOException
Deserialize the fields of this object from in.

For efficiency, implementations should attempt to re-use storage in the existing object where possible.

Specified by:
readFields in interface Writable
Parameters:
in - DataInput to deseriablize this object from.
Throws:
IOException

write

public void write(DataOutput out)
           throws IOException
Serialize the fields of this object to out.

Specified by:
write in interface Writable
Parameters:
out - DataOuput to serialize this object into.
Throws:
IOException

encodeToUrlString

public String encodeToUrlString()
                         throws IOException
Encode this token as a url safe string

Returns:
the encoded string
Throws:
IOException

decodeFromUrlString

public void decodeFromUrlString(String newValue)
                         throws IOException
Decode the given url safe string into this token.

Parameters:
newValue - the encoded string
Throws:
IOException

equals

public boolean equals(Object right)
Overrides:
equals in class Object

hashCode

public int hashCode()
Overrides:
hashCode in class Object

toString

public String toString()
Overrides:
toString in class Object


Copyright © 2009 The Apache Software Foundation