org.apache.jackrabbit.api.security.authentication.token
Class TokenCredentials

java.lang.Object
  extended by org.apache.jackrabbit.api.security.authentication.token.TokenCredentials
All Implemented Interfaces:
Serializable, Credentials

public final class TokenCredentials
extends Object
implements Credentials

TokenCredentials implements the Credentials interface and represents single token credentials. Similar to SimpleCredentials this credentials implementation allows to set additional attributes.

See Also:
Serialized Form

Constructor Summary
TokenCredentials(String token)
          Create a new instance.
 
Method Summary
 String getAttribute(String name)
          Returns the value of the named attribute as an Object, or null if no attribute of the given name exists.
 String[] getAttributeNames()
          Returns the names of the attributes available to this credentials instance.
 String getToken()
          Returns the token this credentials are built from.
 void removeAttribute(String name)
          Removes an attribute from this credentials instance.
 void setAttribute(String name, String value)
          Stores an attribute in this credentials instance.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TokenCredentials

public TokenCredentials(String token)
                 throws IllegalArgumentException
Create a new instance.

Parameters:
token - A token string used to create this credentials instance.
Throws:
IllegalArgumentException - If the specified token is null or empty string.
Method Detail

getToken

public String getToken()
Returns the token this credentials are built from.

Returns:
the token.

setAttribute

public void setAttribute(String name,
                         String value)
Stores an attribute in this credentials instance.

Parameters:
name - a String specifying the name of the attribute
value - the Object to be stored

getAttribute

public String getAttribute(String name)
Returns the value of the named attribute as an Object, or null if no attribute of the given name exists.

Parameters:
name - a String specifying the name of the attribute
Returns:
an Object containing the value of the attribute, or null if the attribute does not exist

removeAttribute

public void removeAttribute(String name)
Removes an attribute from this credentials instance.

Parameters:
name - a String specifying the name of the attribute to remove

getAttributeNames

public String[] getAttributeNames()
Returns the names of the attributes available to this credentials instance. This method returns an empty array if the credentials instance has no attributes available to it.

Returns:
a string array containing the names of the stored attributes


Copyright © 2004-2014 The Apache Software Foundation. All Rights Reserved.