g-Eclipse
Release 1.0.0

eu.geclipse.core.auth
Class AuthenticationTokenManager

java.lang.Object
  extended by eu.geclipse.core.security.BaseSecurityManager
      extended by eu.geclipse.core.auth.AuthenticationTokenManager
All Implemented Interfaces:
ISecurityManager

public class AuthenticationTokenManager
extends BaseSecurityManager

The AuthenticationTokenManager manages all types of authentication tokens. It holds an internal list of all currently available authentication tokens. Although the authentication token manager is the base class of the token management system, non-core classes should use an IAuthTokenProvider to request a token.


Method Summary
 IAuthenticationToken createToken(IAuthenticationTokenDescription description)
          Create a new authentication token from the specified token description and adds it to the list of managed tokens.
 void destroyToken(IAuthenticationToken token)
          Destroy the specified IAuthenticationToken.
 IAuthenticationToken findToken(IAuthenticationTokenDescription description)
          Searches for an authentication token that matches the specified description.
 IAuthenticationToken getDefaultToken()
          Get the currently defined default token.
static AuthenticationTokenManager getManager()
          Get the singleton.
 int getTokenCount()
          Get the number of currently available tokens.
 java.util.List<IAuthenticationToken> getTokens()
          Get all tokens that are currently available.
 boolean isEmpty()
          Determine if this token manager's list of managed tokens is currently empty.
 void setDefaultToken(IAuthenticationToken token)
          Set the specified token to be the default token.
 
Methods inherited from class eu.geclipse.core.security.BaseSecurityManager
addListener, fireContentChanged, removeListener
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getManager

public static AuthenticationTokenManager getManager()
Get the singleton. There is only one instance of the AuthenticationTokenManager that is created and returned by this method.

Returns:
The singleton.

createToken

public IAuthenticationToken createToken(IAuthenticationTokenDescription description)
                                 throws AuthenticationException
Create a new authentication token from the specified token description and adds it to the list of managed tokens.

Parameters:
description - The description from which to create the new token.
Returns:
A new authentication token constructed from the specified description.
Throws:
AuthenticationException - If an error occurs while creating the token
See Also:
IAuthenticationTokenDescription.createToken()

findToken

public IAuthenticationToken findToken(IAuthenticationTokenDescription description)
Searches for an authentication token that matches the specified description. If no token could be found null is returned.

Parameters:
description - The IAuthenticationTokenDescription that describes the token.
Returns:
A token that matches the specified description or null if no such token could be found.

getTokens

public java.util.List<IAuthenticationToken> getTokens()
Get all tokens that are currently available.

Returns:
A copy of the internal list of managed tokens.

destroyToken

public void destroyToken(IAuthenticationToken token)
                  throws AuthenticationException
Destroy the specified IAuthenticationToken. This means especially that the specified token is removed from the list of currently managed tokens. Therefore this token is not longer accessible from this manager and should not longer be used.

Parameters:
token - The IAuthenticationToken to be destroyed.
Throws:
AuthenticationException

getTokenCount

public int getTokenCount()
Get the number of currently available tokens.

Returns:
The number of tokens that are currently contained in the internal list of managed tokens.

isEmpty

public boolean isEmpty()
Determine if this token manager's list of managed tokens is currently empty.

Returns:
True if there are no tokens available, false otherwise.

setDefaultToken

public void setDefaultToken(IAuthenticationToken token)
Set the specified token to be the default token. The default token is used whenever no specific token is used.

Parameters:
token - The token to be the default token. The default token is only changed if the specified token is in the list of managed tokens and is not already set as the default token.
See Also:
getDefaultToken()

getDefaultToken

public IAuthenticationToken getDefaultToken()
Get the currently defined default token.

Returns:
The token that is currently defined to be the default token.
See Also:
setDefaultToken(IAuthenticationToken)

g-Eclipse
Release 1.0.0