Class ApplicationController
java.lang.Object
com.atlassian.crowd.plugin.rest.service.controller.application.ApplicationController
Controller for the Application resource.
- Since:
- 2.2
-
Constructor Summary
ConstructorsConstructorDescriptionApplicationController
(ApplicationManager applicationManager, DirectoryManager directoryManager, TrustedProxyManager trustedProxyManager, AliasManager aliasManager) -
Method Summary
Modifier and TypeMethodDescriptioncom.atlassian.plugins.rest.api.model.Link
addApplication
(ApplicationEntity applicationEntity, URI baseUri) Adds a new application.com.atlassian.plugins.rest.api.model.Link
addApplicationWithRequestAddress
(ApplicationEntity applicationEntity, javax.servlet.http.HttpServletRequest request, URI baseUri) Adds a new application with the request address.void
addRemoteAddress
(long applicationId, RemoteAddressEntity remoteAddressEntity) Adds a remote address to the list of allowed addresses for the application.void
deleteAlias
(long applicationId, String username) void
deleteAllAliasesForUser
(String username) getAliasesForUser
(String username) getAllApplications
(URI baseUri) Finds all applications.getApplicationById
(long id, URI baseUri) Finds an application by ID.getApplicationByName
(String name, URI baseUri) Finds an application by name.getRequestAddresses
(javax.servlet.http.HttpServletRequest request) Retrieves the list of request addresses.getUsernameForAlias
(long applicationId, String alias) void
removeApplication
(long applicationId) Removes an application.void
removeRemoteAddress
(long applicationId, String remoteAddress) Removes a remote address from the list of allowed addresses for the application.void
void
setAliasesForUser
(String username, Map<Long, String> aliasByApplication) void
updateApplication
(ApplicationEntity applicationEntity) Updates an existing application.
-
Constructor Details
-
ApplicationController
@Inject public ApplicationController(ApplicationManager applicationManager, DirectoryManager directoryManager, TrustedProxyManager trustedProxyManager, AliasManager aliasManager)
-
-
Method Details
-
getApplicationByName
public ApplicationEntity getApplicationByName(String name, URI baseUri) throws ApplicationNotFoundException Finds an application by name.- Parameters:
name
- name of the applicationbaseUri
- base URI of the REST service- Returns:
- ApplicationEntity
- Throws:
ApplicationNotFoundException
- if the application could not be found
-
getApplicationById
public ApplicationEntity getApplicationById(long id, URI baseUri) throws ApplicationNotFoundException Finds an application by ID.- Parameters:
id
- ID of the applicationbaseUri
- baseURI of the applications resource- Returns:
- ApplicationEntity
- Throws:
ApplicationNotFoundException
- if the application could not be found
-
getAllApplications
Finds all applications.- Parameters:
baseUri
- base URI of the REST service- Returns:
- ApplicationEntity
- Throws:
ApplicationNotFoundException
- if the application could not be found
-
addApplicationWithRequestAddress
public com.atlassian.plugins.rest.api.model.Link addApplicationWithRequestAddress(ApplicationEntity applicationEntity, javax.servlet.http.HttpServletRequest request, URI baseUri) throws InvalidCredentialException, DirectoryNotFoundException, ApplicationAlreadyExistsException Adds a new application with the request address.- Parameters:
applicationEntity
- new application to addrequest
- HTTP requestbaseUri
- base URI of the REST service- Returns:
- link to the new application
- Throws:
InvalidCredentialException
- if the given credentials are not validDirectoryNotFoundException
- if the directory being mapped could not be foundApplicationAlreadyExistsException
-
addApplication
public com.atlassian.plugins.rest.api.model.Link addApplication(ApplicationEntity applicationEntity, URI baseUri) throws InvalidCredentialException, DirectoryNotFoundException, ApplicationAlreadyExistsException Adds a new application.- Parameters:
applicationEntity
- new application to addbaseUri
- base URI of the REST service- Returns:
- link to the new application
- Throws:
InvalidCredentialException
- if the given credentials are not validDirectoryNotFoundException
- if the directory being mapped could not be foundApplicationAlreadyExistsException
-
removeApplication
Removes an application.- Parameters:
applicationId
- ID of the application- Throws:
ApplicationManagerException
- if the remove operation is not permitted on the given application
-
updateApplication
public void updateApplication(ApplicationEntity applicationEntity) throws ApplicationNotFoundException, ApplicationManagerException, DirectoryNotFoundException Updates an existing application.- Parameters:
applicationEntity
- application entity with the new details- Throws:
ApplicationNotFoundException
- if the application could not be foundApplicationManagerException
- if there was an error updating the applicationDirectoryNotFoundException
- if a directory referenced by a directory mapping could not be found
-
addRemoteAddress
public void addRemoteAddress(long applicationId, RemoteAddressEntity remoteAddressEntity) throws ApplicationNotFoundException Adds a remote address to the list of allowed addresses for the application.- Parameters:
applicationId
- ID of the applicationremoteAddressEntity
- remote address entity to add- Throws:
ApplicationNotFoundException
- if the application could not be found
-
removeRemoteAddress
public void removeRemoteAddress(long applicationId, String remoteAddress) throws ApplicationNotFoundException Removes a remote address from the list of allowed addresses for the application.- Parameters:
applicationId
- ID of the applicationremoteAddress
- remote address to remove- Throws:
ApplicationNotFoundException
- if the application could not be found
-
getRequestAddresses
Retrieves the list of request addresses.- Parameters:
request
- HTTP request- Returns:
- list of request addresses
-
getAlias
public String getAlias(long applicationId, String username) throws ApplicationNotFoundException, javax.ws.rs.NotFoundException - Throws:
ApplicationNotFoundException
javax.ws.rs.NotFoundException
-
setAlias
public void setAlias(long applicationId, String username, String alias) throws ApplicationNotFoundException, AliasAlreadyInUseException -
deleteAlias
public void deleteAlias(long applicationId, String username) throws ApplicationNotFoundException, AliasAlreadyInUseException -
getUsernameForAlias
public String getUsernameForAlias(long applicationId, String alias) throws ApplicationNotFoundException - Throws:
ApplicationNotFoundException
-
getAliasesForUser
-
setAliasesForUser
public void setAliasesForUser(String username, Map<Long, String> aliasByApplication) throws AliasAlreadyInUseException- Throws:
AliasAlreadyInUseException
-
deleteAllAliasesForUser
-