Interface AliasManager

All Known Implementing Classes:
AliasManagerImpl

public interface AliasManager
API to manage application-specific user aliases.
  • Method Details

    • findUsernameByAlias

      String findUsernameByAlias(Application application, String authenticatingUsername)
      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
      Parameters:
      application - the application the user is associated with
      authenticatingUsername - the username passed to the application for authentication
      Returns:
      The 'real' username of the authenticating user, or the passed in username
      Throws:
      IllegalArgumentException - if either application or authenticatingUsername are null
    • findAliasByUsername

      String findAliasByUsername(Application application, String username)
      Will return the 'alias' associated to the user. If an alias does not exist the 'real' username will be returned
      Parameters:
      application - the application the user is associated with
      username - the 'real' username of the user
      Returns:
      if an alias exists it will be returned, otherwise the username will be returned.
      Throws:
      IllegalArgumentException - if either application or authenticatingUsername are null
    • search

      List<String> search(EntityQuery entityQuery)
      Perform an AliasQuery search on the alias tables of Crowd.
      Parameters:
      entityQuery - Will accept an entity query for aliases as an AliasQuery
      Returns:
      a List<String> of usernames for a given AliasQuery or an empty list
    • storeAlias

      void storeAlias(Application application, String username, String alias) throws AliasAlreadyInUseException
      Add or update the application-specific alias for a username.
      Parameters:
      application - application context.
      username - real username of user in directory.
      alias - application-specific alias (cannot be null or blank).
      Throws:
      IllegalArgumentException - if parameters are null or blank.
      AliasAlreadyInUseException - the alias is already in use by another user for the given application.
    • removeAlias

      void removeAlias(Application application, String username) throws AliasAlreadyInUseException
      Remove an application-specific alias for a username. This method will silently succeed if the username has no application-specific alias.
      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.
    • removeAliasesForUser

      void removeAliasesForUser(String username)
      Removes all the aliases registered for a given username in all applications (there may be different users)
      Parameters:
      username - the username for which the aliases will be removed
      Throws:
      AliasAlreadyInUseException - the username is already in use by another user as their alias in at least one of the alias-enabled applications
    • findAliasesByUsernames

      Map<String,String> findAliasesByUsernames(Application application, Iterable<String> usernames)
      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.
      Parameters:
      application - application context
      usernames - the usernames for which the aliases will be retrieved
      Returns:
      a map from username to alias
    • findAllAliasesByUsernames

      @ExperimentalApi Map<String,String> findAllAliasesByUsernames(Application application)
      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.
      Parameters:
      application - application context
      Returns:
      a map from username to alias