Class StaticUserDirectory

java.lang.Object
org.ametys.runtime.plugin.component.AbstractLogEnabled
org.ametys.plugins.core.impl.user.directory.StaticUserDirectory
All Implemented Interfaces:
UserDirectory, LogEnabled, Component

This implementation only uses predefined users
  • Constructor Details

  • Method Details

    • getId

      public String getId()
      Description copied from interface: UserDirectory
      A unique identifier
      Specified by:
      getId in interface UserDirectory
      Returns:
      The non-null and non-empty identifier
    • getLabel

      public String getLabel()
      Description copied from interface: UserDirectory
      Get the label of the CredentialProvider
      Specified by:
      getLabel in interface UserDirectory
      Returns:
      The optionnal label
    • init

      public void init(String id, String udModelId, Map<String,Object> paramValues, String label)
      Description copied from interface: UserDirectory
      Initialize the user's directory with given parameters' values.
      Specified by:
      init in interface UserDirectory
      Parameters:
      id - The non-null and non-empty unique identifier
      udModelId - The id of user directory extension point
      paramValues - The parameters' values
      label - The optional label
    • setPopulationId

      public void setPopulationId(String populationId)
      Description copied from interface: UserDirectory
      Set the value of the id of the population this user directory belong to.
      Specified by:
      setPopulationId in interface UserDirectory
      Parameters:
      populationId - The id of the population the user directory belongs to.
    • getPopulationId

      Description copied from interface: UserDirectory
      Get the id of the population this user directory belongs to.
      Specified by:
      getPopulationId in interface UserDirectory
      Returns:
      The id of the population
    • getParameterValues

      Description copied from interface: UserDirectory
      Get the values of parameters (from user directory model)
      Specified by:
      getParameterValues in interface UserDirectory
      Returns:
      the parameters' values
    • setGrantAllCredentials

      public void setGrantAllCredentials(boolean grantAllCredentials)
      Set to false to disallow any user to be authenticated by its credentials
      Parameters:
      grantAllCredentials - true if the directory should grant all call to checkCredentials
    • getUserDirectoryModelId

      Description copied from interface: UserDirectory
      Get the id of the UserDirectoryModel extension point
      Specified by:
      getUserDirectoryModelId in interface UserDirectory
      Returns:
      the id of extension point
    • getUsers

      Description copied from interface: UserDirectory
      Get the list of all users of one directory.
      Specified by:
      getUsers in interface UserDirectory
      Returns:
      list of users as Collection of Users, empty if a problem occurs.
    • getUsers

      public List<User> getUsers(int count, int offset, Map<String,Object> parameters)
      Description copied from interface: UserDirectory
      Get a list of users from a directory given the parameters
      Specified by:
      getUsers in interface UserDirectory
      Parameters:
      count - The limit of users to retrieve
      offset - The number of result to ignore before starting to collect users.
      parameters - A map of additional parameters, see implementation.
      Returns:
      The list of retrieved User
    • getUser

      public User getUser(String login)
      Description copied from interface: UserDirectory
      Get a particular user by his login.
      Specified by:
      getUser in interface UserDirectory
      Parameters:
      login - Login of the user to get. Cannot be null.
      Returns:
      User's information as a User instance or null if the user login does not exist.
    • getUserByEmail

      Description copied from interface: UserDirectory
      Get a particular user by his email (search should be case insensitive).
      Specified by:
      getUserByEmail in interface UserDirectory
      Parameters:
      email - Email of the user to get. Cannot be null.
      Returns:
      User's information as a User instance or null if the user email does not exist.
      Throws:
      NotUniqueUserException - If many users match this email
    • checkCredentials

      public boolean checkCredentials(String login, String password)
      Description copied from interface: UserDirectory
      Authenticate a user with its credentials
      Specified by:
      checkCredentials in interface UserDirectory
      Parameters:
      login - The login to check. Cannot be null.
      password - The password to check.
      Returns:
      true if the user is authenticated, false otherwise.