Class AliasManagerImpl
java.lang.Object
com.atlassian.crowd.manager.application.AliasManagerImpl
- All Implemented Interfaces:
AliasManager
-
Constructor Summary
ConstructorDescriptionAliasManagerImpl
(AliasDAO aliasDAO, ApplicationManager applicationManager, ApplicationService applicationService, com.atlassian.event.api.EventPublisher eventPublisher) -
Method Summary
Modifier and TypeMethodDescriptionfindAliasByUsername
(Application application, String username) Will return the 'alias' associated to the user.findAliasesByUsernames
(Application application, Iterable<String> usernames) Will return application-specific aliases for the provided users.findAllAliasesByUsernames
(Application application) Returns application-specific aliases for all users.findUsernameByAlias
(Application application, String authenticatingUsername) Will return the 'real' username of the authenticating user.void
removeAlias
(Application application, String username) Remove an application-specific alias for a username.void
removeAliasesForUser
(String username) Removes all the aliases registered for a given username in all applications (there may be different users)search
(EntityQuery entityQuery) Perform anAliasQuery
search on the alias tables of Crowd.void
storeAlias
(Application application, String username, String alias) Add or update the application-specific alias for a username.
-
Constructor Details
-
AliasManagerImpl
public AliasManagerImpl(AliasDAO aliasDAO, ApplicationManager applicationManager, ApplicationService applicationService, com.atlassian.event.api.EventPublisher eventPublisher)
-
-
Method Details
-
findUsernameByAlias
Description copied from interface:AliasManager
Will return the 'real' username of the authenticating user. This returned username maybe the username passed in, if the user does not have a configured 'alias' for the given application- Specified by:
findUsernameByAlias
in interfaceAliasManager
- Parameters:
application
- the application the user is associated withauthenticatingUsername
- the username passed to the application for authentication- Returns:
- The 'real' username of the authenticating user, or the passed in username
-
findAliasByUsername
Description copied from interface:AliasManager
Will return the 'alias' associated to the user. If an alias does not exist the 'real' username will be returned- Specified by:
findAliasByUsername
in interfaceAliasManager
- Parameters:
application
- the application the user is associated withusername
- the 'real' username of the user- Returns:
- if an alias exists it will be returned, otherwise the username will be returned.
-
storeAlias
public void storeAlias(Application application, String username, String alias) throws AliasAlreadyInUseException Description copied from interface:AliasManager
Add or update the application-specific alias for a username.- Specified by:
storeAlias
in interfaceAliasManager
- Parameters:
application
- application context.username
- real username of user in directory.alias
- application-specific alias (cannot benull
or blank).- Throws:
AliasAlreadyInUseException
- the alias is already in use by another user for the given application.
-
removeAlias
Description copied from interface:AliasManager
Remove an application-specific alias for a username. This method will silently succeed if the username has no application-specific alias.- Specified by:
removeAlias
in interfaceAliasManager
- Parameters:
application
- application context.username
- real username of user in directory.- Throws:
AliasAlreadyInUseException
- the username is already in use by another user as their alias for the given application.
-
search
Description copied from interface:AliasManager
Perform anAliasQuery
search on the alias tables of Crowd.- Specified by:
search
in interfaceAliasManager
- Parameters:
entityQuery
- Will accept an entity query for aliases as anAliasQuery
- Returns:
- a
List
<String> of usernames for a givenAliasQuery
or an empty list
-
removeAliasesForUser
Description copied from interface:AliasManager
Removes all the aliases registered for a given username in all applications (there may be different users)- Specified by:
removeAliasesForUser
in interfaceAliasManager
- Parameters:
username
- the username for which the aliases will be removed
-
findAliasesByUsernames
public Map<String,String> findAliasesByUsernames(Application application, Iterable<String> usernames) Description copied from interface:AliasManager
Will return application-specific aliases for the provided users. This method will return a Map with usernames as keys and aliases as values. If aliasing is not enabled or no usernames were provided then an empty map will be returned. Users who don't have an alias will not have a corresponding entry in the returned map.- Specified by:
findAliasesByUsernames
in interfaceAliasManager
- Parameters:
application
- application contextusernames
- the usernames for which the aliases will be retrieved- Returns:
- a map from username to alias
-
findAllAliasesByUsernames
Description copied from interface:AliasManager
Returns application-specific aliases for all users. This method will return a Map with usernames as keys and aliases as values. If aliasing is not enabled then an empty map will be returned. Users who don't have an alias will not have a corresponding entry in the returned map.- Specified by:
findAllAliasesByUsernames
in interfaceAliasManager
- Parameters:
application
- application context- Returns:
- a map from username to alias
-