com.atlassian.crowd.manager
Class GenericManager

java.lang.Object
  extended by com.atlassian.crowd.manager.GenericManager
Direct Known Subclasses:
ApplicationServiceGeneric

public abstract class GenericManager
extends java.lang.Object


Field Summary
protected  CacheManager cacheManager
           
protected  DirectoryManager directoryManager
           
protected  I18nHelper i18nHelper
           
protected  org.apache.log4j.Logger logger
           
protected  PropertyManager propertyManager
           
protected  TokenDAO tokenDAO
           
protected  TokenFactory tokenFactory
           
 
Constructor Summary
GenericManager()
           
 
Method Summary
protected  Token generateApplicationToken(ApplicationAuthenticationContext authenticationContext)
           
protected  Token generateUserToken(long directoryID, AuthenticationContext authenticationContext)
          This method will return a Token based on the passed in parameters.
protected  Token genericValidateToken(java.lang.String token, ValidationFactor[] validationFactors)
          Will validate a token key with the given ValidationFactor's against one (if it exists) in the datastore.
 boolean isAllowedToAuthenticate(java.lang.String username, long directoryId, Application application)
          Determines if a user is authorised to authenticate with a given application.
 boolean isAllowedToAuthenticate(Token token, Application application)
           
 boolean isAllowedToAuthenticate(Token token, Application application, boolean ignoreCache)
           
protected  boolean isExpired(Token token)
           
 void setCacheManager(CacheManager cacheManager)
           
 void setDirectoryManager(DirectoryManager directoryManager)
           
 void setI18nHelper(I18nHelper i18nHelper)
           
 void setPropertyManager(PropertyManager propertyManager)
           
 void setTokenDAO(TokenDAO tokenDAO)
           
 void setTokenFactory(TokenFactory tokenFactory)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

logger

protected final org.apache.log4j.Logger logger

tokenDAO

protected TokenDAO tokenDAO

propertyManager

protected PropertyManager propertyManager

i18nHelper

protected I18nHelper i18nHelper

cacheManager

protected CacheManager cacheManager

tokenFactory

protected TokenFactory tokenFactory

directoryManager

protected DirectoryManager directoryManager
Constructor Detail

GenericManager

public GenericManager()
Method Detail

generateUserToken

protected Token generateUserToken(long directoryID,
                                  AuthenticationContext authenticationContext)
                           throws InvalidTokenException
This method will return a Token based on the passed in parameters. If a token already exists in the datastore, this token will be returned with an updated lastAccessed time. If a token is not found based on the passed in parameters a new Token will be generated an stored in the datastore.

Parameters:
directoryID - the directoryID you wish to generate a Token for
authenticationContext - holder for the required attributes to authenticate against the Crowd server
Returns:
a Token
Throws:
InvalidTokenException - if there was an issue generating the key for a token.

generateApplicationToken

protected Token generateApplicationToken(ApplicationAuthenticationContext authenticationContext)
                                  throws InvalidTokenException
Throws:
InvalidTokenException

genericValidateToken

protected Token genericValidateToken(java.lang.String token,
                                     ValidationFactor[] validationFactors)
                              throws InvalidTokenException
Will validate a token key with the given ValidationFactor's against one (if it exists) in the datastore.

Parameters:
token - the key of a Token
validationFactors - the ValidationFactor's that are being used for authentication
Returns:
the existing token if there is a match (with an updated lastAccessed time)
Throws:
InvalidTokenException - thrown if the token keys are not equal, or the token has expired, or the token does not exist

isExpired

protected boolean isExpired(Token token)

isAllowedToAuthenticate

public boolean isAllowedToAuthenticate(java.lang.String username,
                                       long directoryId,
                                       Application application)
                                throws DirectoryAccessException
Determines if a user is authorised to authenticate with a given application.

For a a user to have access to an application:

  1. the Application must be active.

And either:

Note that this call is not cached and does not affect the cache.

Parameters:
application - application the user wants to authenticate with.
username - the username of the user that wants to authenticate with the application.
directoryId - the directoryId of the user that wants to authenticate with the application.
Returns:
true iff the user is authorised to authenticate with the application.
Throws:
DirectoryAccessException - if the directory implementation could not be loaded when performing a membership check.

isAllowedToAuthenticate

public boolean isAllowedToAuthenticate(Token token,
                                       Application application,
                                       boolean ignoreCache)
                                throws DirectoryAccessException
Throws:
DirectoryAccessException

isAllowedToAuthenticate

public boolean isAllowedToAuthenticate(Token token,
                                       Application application)
                                throws DirectoryAccessException
Throws:
DirectoryAccessException

setI18nHelper

public void setI18nHelper(I18nHelper i18nHelper)

setTokenDAO

public void setTokenDAO(TokenDAO tokenDAO)

setPropertyManager

public void setPropertyManager(PropertyManager propertyManager)

setCacheManager

public void setCacheManager(CacheManager cacheManager)

setTokenFactory

public void setTokenFactory(TokenFactory tokenFactory)

setDirectoryManager

public void setDirectoryManager(DirectoryManager directoryManager)


Copyright © 2009 Atlassian Pty Ltd. All Rights Reserved.