com.atlassian.crowd.manager.application
Class ApplicationManagerGeneric

java.lang.Object
  extended by com.atlassian.crowd.manager.GenericManager
      extended by com.atlassian.crowd.manager.application.ApplicationManagerGeneric
All Implemented Interfaces:
ApplicationManager

public class ApplicationManagerGeneric
extends GenericManager
implements ApplicationManager


Field Summary
 
Fields inherited from class com.atlassian.crowd.manager.GenericManager
cacheManager, i18nHelper, logger, propertyManager, tokenDAO
 
Constructor Summary
ApplicationManagerGeneric()
           
 
Method Summary
 Application add(Application application)
          Will add the given Application to Crowd
 java.util.List<Application> findAuthorisedApplications(RemotePrincipal principal)
          Returns a list of applications the principal is authorised to authenticate with.
 Application findByID(long ID)
          Find an application by its ID.
 Application findByName(java.lang.String name)
          Find an application by its name.
 boolean hasAccess(Application application, RemotePrincipal principal)
          Determine if a principal is authorised to authenticate with a given application.
 void remove(Application application)
           
 void removeAllGroupMappings(long directoryID, java.lang.String groupName)
          Will remove all Group mappings from the Applications that are associated to the given directoryId with the given groupName
 void removeDirectoryFromAllApplications(Directory directory)
          Will remove a given directory and its associated mapped objects, such as: ApplicationDirectoryPermission's GroupMapping's and it's DirectoryMapping From all applications
 void removeDirectoryFromApplication(Directory directory, Application application)
          Will remove a directory from an application.
 java.util.List search(SearchContext searchContext)
          Search applications.
 void setApplicationDAO(ApplicationDAO applicationDAO)
           
 void setDirectoryDAO(DirectoryDAO directoryDAO)
           
 void setPasswordEncoderFactory(PasswordEncoderFactory passwordEncoderFactory)
           
 void setPermissionManager(PermissionManager permissionManager)
           
 Application update(Application application)
          Updates an application's details.
 Application updateCredentials(Application application)
          Takes an application with a List of credentials that are unencrypted, encrypts them and then updates the application in the database with the encrypted credentials
 
Methods inherited from class com.atlassian.crowd.manager.GenericManager
generateToken, genericValidateToken, hasAccess, hasAccess, setCacheManager, setI18nHelper, setPropertyManager, setTokenDAO, setTokenFactory
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ApplicationManagerGeneric

public ApplicationManagerGeneric()
Method Detail

add

public Application add(Application application)
                throws InvalidCredentialException
Description copied from interface: ApplicationManager
Will add the given Application to Crowd

Specified by:
add in interface ApplicationManager
Parameters:
application - the Application to add.
Returns:
the added Application
Throws:
InvalidCredentialException - if there was an error encrypting the Applications password

findByID

public Application findByID(long ID)
                     throws ObjectNotFoundException
Description copied from interface: ApplicationManager
Find an application by its ID.

Specified by:
findByID in interface ApplicationManager
Parameters:
ID - database ID.
Returns:
application object.
Throws:
ObjectNotFoundException - application with requested ID does not exist.

findByName

public Application findByName(java.lang.String name)
                       throws ObjectNotFoundException
Description copied from interface: ApplicationManager
Find an application by its name.

Specified by:
findByName in interface ApplicationManager
Parameters:
name - name of application.
Returns:
application object.
Throws:
ObjectNotFoundException - application with requested name does not exist.

remove

public void remove(Application application)
            throws ApplicationManagerException
Specified by:
remove in interface ApplicationManager
Throws:
ApplicationManagerException

removeAllGroupMappings

public void removeAllGroupMappings(long directoryID,
                                   java.lang.String groupName)
                            throws ObjectNotFoundException
Description copied from interface: ApplicationManager
Will remove all Group mappings from the Applications that are associated to the given directoryId with the given groupName

Specified by:
removeAllGroupMappings in interface ApplicationManager
Parameters:
directoryID - the directory associated to Application's
groupName - the name of the group to remove
Throws:
ObjectNotFoundException - if the given Directory cannot be found.

removeDirectoryFromApplication

public void removeDirectoryFromApplication(Directory directory,
                                           Application application)
                                    throws ApplicationManagerException
Description copied from interface: ApplicationManager
Will remove a directory from an application. This will also remove all other mapped objects, such as: ApplicationDirectoryPermission's GroupMapping's and it's DirectoryMapping

Specified by:
removeDirectoryFromApplication in interface ApplicationManager
Parameters:
directory - the directory you wish to disociate
application - the application you wish to apply this dissociation too
Throws:
ApplicationManagerException - thrown if anything goes bad, updating the application

removeDirectoryFromAllApplications

public void removeDirectoryFromAllApplications(Directory directory)
                                        throws ApplicationManagerException
Description copied from interface: ApplicationManager
Will remove a given directory and its associated mapped objects, such as: ApplicationDirectoryPermission's GroupMapping's and it's DirectoryMapping From all applications

Specified by:
removeDirectoryFromAllApplications in interface ApplicationManager
Parameters:
directory - the directory to remove from all applications
Throws:
ApplicationManagerException - thrown if anything goes bad updating an application

search

public java.util.List search(SearchContext searchContext)
Description copied from interface: ApplicationManager
Search applications.

Specified by:
search in interface ApplicationManager
Parameters:
searchContext - search criteria.
Returns:
list of Applications.

update

public Application update(Application application)
                   throws ApplicationManagerException
Description copied from interface: ApplicationManager
Updates an application's details.

Specified by:
update in interface ApplicationManager
Parameters:
application - modified application.
Returns:
modified application.
Throws:
ApplicationManagerException - error updating application.

updateCredentials

public Application updateCredentials(Application application)
                              throws ApplicationManagerException,
                                     InvalidCredentialException
Description copied from interface: ApplicationManager
Takes an application with a List of credentials that are unencrypted, encrypts them and then updates the application in the database with the encrypted credentials

Specified by:
updateCredentials in interface ApplicationManager
Parameters:
application - an application with unencrypted password credentials
Returns:
the updated application with encrypted credentials
Throws:
ApplicationManagerException
InvalidCredentialException

findAuthorisedApplications

public java.util.List<Application> findAuthorisedApplications(RemotePrincipal principal)
Returns a list of applications the principal is authorised to authenticate with.

This method iteratively calls ApplicationManagerGeneric.hasAccess(Application, RemotePrincipal) on all applications.

Specified by:
findAuthorisedApplications in interface ApplicationManager
Parameters:
principal - principal to search for.
Returns:
list of applications.

hasAccess

public boolean hasAccess(Application application,
                         RemotePrincipal principal)
Determine if a principal is authorised to authenticate with a given application.

For a a principal to have access to an application:

  1. the RemotePrincipal must be active.
  2. the Application must be active.

And either:

Note that this call is not cached and does not affect the cache. Internally, calls to determine if an prinicpal has access to an application are cached - and go via a different method call. See GenericManager.hasAccess(Application, Token).

Parameters:
application - application to check.
principal - principal to check.
Returns:
true iff the above conditions are met.

setApplicationDAO

public void setApplicationDAO(ApplicationDAO applicationDAO)

setDirectoryDAO

public void setDirectoryDAO(DirectoryDAO directoryDAO)

setPermissionManager

public void setPermissionManager(PermissionManager permissionManager)

setPasswordEncoderFactory

public void setPasswordEncoderFactory(PasswordEncoderFactory passwordEncoderFactory)


Copyright © 2009 Atlassian Pty Ltd. All Rights Reserved.