@Transactional public class ApplicationManagerGeneric extends Object implements ApplicationManager
Constructor and Description |
---|
ApplicationManagerGeneric(ApplicationDAO applicationDao,
PasswordEncoderFactory passwordEncoderFactory,
com.atlassian.event.api.EventPublisher eventPublisher) |
Modifier and Type | Method and Description |
---|---|
Application |
add(Application application)
Will add the given Application to Crowd
|
void |
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 application
|
boolean |
authenticate(Application application,
PasswordCredential testCredential)
Takes an application, which contains a hashed credential, and compares that
to a hash of the supplied testCredential.
|
List<Application> |
findAll()
Retrieves all the applications in the Crowd system.
|
Application |
findById(long id)
Find an application by its ID.
|
Application |
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 application
|
List<Application> |
search(EntityQuery query)
Search applications.
|
Application |
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 credentials
|
void |
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.
|
public ApplicationManagerGeneric(ApplicationDAO applicationDao, PasswordEncoderFactory passwordEncoderFactory, com.atlassian.event.api.EventPublisher eventPublisher)
public Application add(Application application) throws InvalidCredentialException, ApplicationAlreadyExistsException
ApplicationManager
add
in interface ApplicationManager
application
- the Application to add.InvalidCredentialException
- if there was an error encrypting the Applications passwordApplicationAlreadyExistsException
- if an application with the same name already existspublic Application findById(long id) throws ApplicationNotFoundException
ApplicationManager
findById
in interface ApplicationManager
id
- database ID.ApplicationNotFoundException
- application with requested ID does not exist.public Application findByName(String name) throws ApplicationNotFoundException
ApplicationManager
findByName
in interface ApplicationManager
name
- name of application.ApplicationNotFoundException
- application with requested name does not exist.public void remove(Application application) throws ApplicationManagerException
ApplicationManager
remove
in interface ApplicationManager
application
- application to remove.ApplicationManagerException
- if the remove operation is not permitted on the given application.public void removeDirectoryFromApplication(Directory directory, Application application) throws ApplicationManagerException
ApplicationManager
removeDirectoryFromApplication
in interface ApplicationManager
directory
- the directory you wish to disociateapplication
- the application you wish to apply this dissociation tooApplicationManagerException
- thrown if anything goes bad, updating the applicationpublic List<Application> search(EntityQuery query)
ApplicationManager
search
in interface ApplicationManager
query
- Application entity query.public List<Application> findAll()
ApplicationManager
findAll
in interface ApplicationManager
public Application update(Application application) throws ApplicationManagerException, ApplicationNotFoundException
ApplicationManager
update
in interface ApplicationManager
application
- modified application.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 foundpublic void updateCredential(Application application, PasswordCredential passwordCredential) throws ApplicationManagerException, ApplicationNotFoundException
ApplicationManager
updateCredential
in interface ApplicationManager
application
- an application with unencrypted password credentialspasswordCredential
- unencrypted password.ApplicationManagerException
- not allowed to update.ApplicationNotFoundException
- if the application could not be foundpublic boolean authenticate(Application application, PasswordCredential testCredential) throws ApplicationNotFoundException
ApplicationManager
authenticate
in interface ApplicationManager
application
- application to authenticate as.testCredential
- credentials to authenticate with.true
iff the testCredential matches the actual application credential.ApplicationNotFoundException
- if the application could not be foundpublic void addDirectoryMapping(Application application, Directory directory, boolean allowAllToAuthenticate, OperationType... operationTypes) throws ApplicationNotFoundException, DirectoryNotFoundException
ApplicationManager
addDirectoryMapping
in interface ApplicationManager
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 mappingApplicationNotFoundException
- if the application could not be foundDirectoryNotFoundException
- if the directory could not be foundpublic void updateDirectoryMapping(Application application, Directory directory, int position) throws ApplicationNotFoundException, DirectoryNotFoundException
ApplicationManager
updateDirectoryMapping
in interface ApplicationManager
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 shiftApplicationNotFoundException
- if the application could not be foundDirectoryNotFoundException
- if the directory could not be foundpublic void updateDirectoryMapping(Application application, Directory directory, boolean allowAllToAuthenticate) throws ApplicationNotFoundException, DirectoryNotFoundException
ApplicationManager
updateDirectoryMapping
in interface ApplicationManager
application
- the application in questiondirectory
- the directory associated to the applicationallowAllToAuthenticate
- to enable/disable the allow all to authenticate flagApplicationNotFoundException
- if the application could not be foundDirectoryNotFoundException
- if the directory could not be foundpublic void updateDirectoryMapping(Application application, Directory directory, boolean allowAllToAuthenticate, Set<OperationType> operationTypes) throws ApplicationNotFoundException, DirectoryNotFoundException
ApplicationManager
updateDirectoryMapping
in interface ApplicationManager
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 mappingApplicationNotFoundException
- if the application could not be foundDirectoryNotFoundException
- if the directory could not be foundpublic void addRemoteAddress(Application application, RemoteAddress remoteAddress) throws ApplicationNotFoundException
ApplicationManager
addRemoteAddress
in interface ApplicationManager
application
- the application to updateremoteAddress
- the remote address to addApplicationNotFoundException
- if the application could not be foundpublic void removeRemoteAddress(Application application, RemoteAddress remoteAddress) throws ApplicationNotFoundException
ApplicationManager
removeRemoteAddress
in interface ApplicationManager
application
- the application to updateremoteAddress
- the remote address to removeApplicationNotFoundException
- if the application could not be foundpublic void addGroupMapping(Application application, Directory directory, String groupName) throws ApplicationNotFoundException
ApplicationManager
addGroupMapping
in interface ApplicationManager
application
- the application to updatedirectory
- the directory associated to the applicationgroupName
- the group name to addApplicationNotFoundException
- if the application could not be foundpublic void removeGroupMapping(Application application, Directory directory, String groupName) throws ApplicationNotFoundException
ApplicationManager
removeGroupMapping
in interface ApplicationManager
application
- the application to updatedirectory
- the directory associated to the applicationgroupName
- the group name to removeApplicationNotFoundException
Copyright © 2021 Atlassian. All rights reserved.