Class ApplicationManagerGeneric
java.lang.Object
com.atlassian.crowd.manager.application.ApplicationManagerGeneric
- All Implemented Interfaces:
ApplicationManager
-
Constructor Summary
ConstructorsConstructorDescriptionApplicationManagerGeneric
(ApplicationDAO applicationDao, PasswordEncoderFactory passwordEncoderFactory, com.atlassian.event.api.EventPublisher eventPublisher) -
Method Summary
Modifier and TypeMethodDescriptionadd
(Application application) Will add the given Application to Crowdvoid
addDirectoryMapping
(Application application, Directory directory, boolean allowAllToAuthenticate, OperationType... operationTypes) Will add a DirectoryMapping between the passed in Application and Directory.void
addGroupMapping
(Application application, Directory directory, String groupName) Will add a group mapping for the given application + directory mapping.void
addRemoteAddress
(Application application, RemoteAddress remoteAddress) Will add a remote address to the current applicationboolean
authenticate
(Application application, PasswordCredential testCredential) Takes an application, which contains a hashed credential, and compares that to a hash of the supplied testCredential.findAll()
Retrieves all the applications in the Crowd system.findById
(long id) Find an application by its ID.findByName
(String name) Find an application by its name.void
remove
(Application application) Remove an application.void
removeDirectoryFromApplication
(Directory directory, Application application) Will remove a directory from an application.void
removeGroupMapping
(Application application, Directory directory, String groupName) Will remove a group mapping for the given application + directory mapping.void
removeRemoteAddress
(Application application, RemoteAddress remoteAddress) Will remove the passed in RemoteAddress from the applicationsearch
(EntityQuery query) Search applications.update
(Application application) Updates an application's details.void
updateCredential
(Application application, PasswordCredential passwordCredential) Takes an application with a List of credentials that are unencrypted, encrypts them and then updates the application in the database with the encrypted credentialsvoid
updateDirectoryMapping
(Application application, Directory directory, boolean allowAllToAuthenticate) Will update the Directory Mapping, setting to enable/disable allowing all users to authenticate for the given mapping (not taking group membership into consideration)void
updateDirectoryMapping
(Application application, Directory directory, boolean allowAllToAuthenticate, Set<OperationType> operationTypes) Will update a directory mapping against the Application moving it to the selected position in the list of DirectoryMappings.void
updateDirectoryMapping
(Application application, Directory directory, int position) Will update a directory mapping against the Application moving it to the selected position in the list of DirectoryMappings.
-
Constructor Details
-
ApplicationManagerGeneric
public ApplicationManagerGeneric(ApplicationDAO applicationDao, PasswordEncoderFactory passwordEncoderFactory, com.atlassian.event.api.EventPublisher eventPublisher)
-
-
Method Details
-
add
public Application add(Application application) throws InvalidCredentialException, ApplicationAlreadyExistsException Description copied from interface:ApplicationManager
Will add the given Application to Crowd- Specified by:
add
in interfaceApplicationManager
- Parameters:
application
- the Application to add.- Returns:
- the added Application
- Throws:
InvalidCredentialException
- if there was an error encrypting the Applications passwordApplicationAlreadyExistsException
- if an application with the same name already exists
-
findById
Description copied from interface:ApplicationManager
Find an application by its ID.- Specified by:
findById
in interfaceApplicationManager
- Parameters:
id
- database ID.- Returns:
- application object.
- Throws:
ApplicationNotFoundException
- application with requested ID does not exist.
-
findByName
Description copied from interface:ApplicationManager
Find an application by its name.- Specified by:
findByName
in interfaceApplicationManager
- Parameters:
name
- name of application.- Returns:
- application object.
- Throws:
ApplicationNotFoundException
- application with requested name does not exist.
-
remove
Description copied from interface:ApplicationManager
Remove an application.- Specified by:
remove
in interfaceApplicationManager
- Parameters:
application
- application to remove.- Throws:
ApplicationManagerException
- if the remove operation is not permitted on the given application.
-
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.- Specified by:
removeDirectoryFromApplication
in interfaceApplicationManager
- Parameters:
directory
- the directory you wish to disociateapplication
- the application you wish to apply this dissociation too- Throws:
ApplicationManagerException
- thrown if anything goes bad, updating the application
-
search
Description copied from interface:ApplicationManager
Search applications.- Specified by:
search
in interfaceApplicationManager
- Parameters:
query
- Application entity query.- Returns:
- list of Applications.
-
findAll
Description copied from interface:ApplicationManager
Retrieves all the applications in the Crowd system.- Specified by:
findAll
in interfaceApplicationManager
- Returns:
- List of all Applications.
-
update
public Application update(Application application) throws ApplicationManagerException, ApplicationNotFoundException Description copied from interface:ApplicationManager
Updates an application's details.- Specified by:
update
in interfaceApplicationManager
- Parameters:
application
- modified application.- Returns:
- modified application.
- Throws:
ApplicationManagerException
- error updating application, ie. if you try to rename a permanent application or try to deactivate the CROWD application.ApplicationNotFoundException
- if the application could not be found
-
updateCredential
public void updateCredential(Application application, PasswordCredential passwordCredential) throws ApplicationManagerException, ApplicationNotFoundException 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:
updateCredential
in interfaceApplicationManager
- Parameters:
application
- an application with unencrypted password credentialspasswordCredential
- unencrypted password.- Throws:
ApplicationManagerException
- not allowed to update.ApplicationNotFoundException
- if the application could not be found
-
authenticate
public boolean authenticate(Application application, PasswordCredential testCredential) throws ApplicationNotFoundException Description copied from interface:ApplicationManager
Takes an application, which contains a hashed credential, and compares that to a hash of the supplied testCredential.- Specified by:
authenticate
in interfaceApplicationManager
- Parameters:
application
- application to authenticate as.testCredential
- credentials to authenticate with.- Returns:
true
iff the testCredential matches the actual application credential.- Throws:
ApplicationNotFoundException
- if the application could not be found
-
addDirectoryMapping
public void addDirectoryMapping(Application application, Directory directory, boolean allowAllToAuthenticate, OperationType... operationTypes) throws ApplicationNotFoundException, DirectoryNotFoundException Description copied from interface:ApplicationManager
Will add a DirectoryMapping between the passed in Application and Directory. This mapping will be added to the end of the current list of mappings. If a directory mapping already exists for this association this call will simply operate as an update for the given mapping.- Specified by:
addDirectoryMapping
in interfaceApplicationManager
- Parameters:
application
- the application in questiondirectory
- the directory associated to the applicationallowAllToAuthenticate
- to enable/disable the allow all to authenticate flagoperationTypes
- The set of allowed operations for the given directory/application mapping- Throws:
ApplicationNotFoundException
- if the application could not be foundDirectoryNotFoundException
- if the directory could not be found
-
updateDirectoryMapping
public void updateDirectoryMapping(Application application, Directory directory, int position) throws ApplicationNotFoundException, DirectoryNotFoundException Description copied from interface:ApplicationManager
Will update a directory mapping against the Application moving it to the selected position in the list of DirectoryMappings.- Specified by:
updateDirectoryMapping
in interfaceApplicationManager
- Parameters:
application
- the application in questiondirectory
- the directory associated to the applicationposition
- This will recognise the need to shift a mapping either up or down in the. A -ve value will not result in an index shift- Throws:
ApplicationNotFoundException
- if the application could not be foundDirectoryNotFoundException
- if the directory could not be found
-
updateDirectoryMapping
public void updateDirectoryMapping(Application application, Directory directory, boolean allowAllToAuthenticate) throws ApplicationNotFoundException, DirectoryNotFoundException Description copied from interface:ApplicationManager
Will update the Directory Mapping, setting to enable/disable allowing all users to authenticate for the given mapping (not taking group membership into consideration)- Specified by:
updateDirectoryMapping
in interfaceApplicationManager
- Parameters:
application
- the application in questiondirectory
- the directory associated to the applicationallowAllToAuthenticate
- to enable/disable the allow all to authenticate flag- Throws:
ApplicationNotFoundException
- if the application could not be foundDirectoryNotFoundException
- if the directory could not be found
-
updateDirectoryMapping
public void updateDirectoryMapping(Application application, Directory directory, boolean allowAllToAuthenticate, Set<OperationType> operationTypes) throws ApplicationNotFoundException, DirectoryNotFoundException Description copied from interface:ApplicationManager
Will update a directory mapping against the Application moving it to the selected position in the list of DirectoryMappings.- Specified by:
updateDirectoryMapping
in interfaceApplicationManager
- Parameters:
application
- the application in questiondirectory
- the directory associated to the applicationallowAllToAuthenticate
- to enable/disable the allow all to authenticate flagoperationTypes
- The set of allowed operations for the given directory/application mapping- Throws:
ApplicationNotFoundException
- if the application could not be foundDirectoryNotFoundException
- if the directory could not be found
-
addRemoteAddress
public void addRemoteAddress(Application application, RemoteAddress remoteAddress) throws ApplicationNotFoundException Description copied from interface:ApplicationManager
Will add a remote address to the current application- Specified by:
addRemoteAddress
in interfaceApplicationManager
- Parameters:
application
- the application to updateremoteAddress
- the remote address to add- Throws:
ApplicationNotFoundException
- if the application could not be found
-
removeRemoteAddress
public void removeRemoteAddress(Application application, RemoteAddress remoteAddress) throws ApplicationNotFoundException Description copied from interface:ApplicationManager
Will remove the passed in RemoteAddress from the application- Specified by:
removeRemoteAddress
in interfaceApplicationManager
- Parameters:
application
- the application to updateremoteAddress
- the remote address to remove- Throws:
ApplicationNotFoundException
- if the application could not be found
-
addGroupMapping
public void addGroupMapping(Application application, Directory directory, String groupName) throws ApplicationNotFoundException Description copied from interface:ApplicationManager
Will add a group mapping for the given application + directory mapping.- Specified by:
addGroupMapping
in interfaceApplicationManager
- Parameters:
application
- the application to updatedirectory
- the directory associated to the applicationgroupName
- the group name to add- Throws:
ApplicationNotFoundException
- if the application could not be found
-
removeGroupMapping
public void removeGroupMapping(Application application, Directory directory, String groupName) throws ApplicationNotFoundException Description copied from interface:ApplicationManager
Will remove a group mapping for the given application + directory mapping.- Specified by:
removeGroupMapping
in interfaceApplicationManager
- Parameters:
application
- the application to updatedirectory
- the directory associated to the applicationgroupName
- the group name to remove- Throws:
ApplicationNotFoundException
-