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 Summary
-
Method Summary
Modifier and TypeMethodDescriptionboolean
checkCredentials
(String login, String password) Authenticate a user with its credentialsgetId()
A unique identifiergetLabel()
Get the label of the CredentialProviderGet the values of parameters (from user directory model)Get the id of the population this user directory belongs to.Get a particular user by his login.getUserByEmail
(String email) Get a particular user by his email.Get the id of theUserDirectoryModel
extension pointgetUsers()
Get the list of all users of one directory.Get a list of users from a directory given the parametersvoid
Initialize the user's directory with given parameters' values.void
setGrantAllCredentials
(boolean grantAllCredentials) Set to false to disallow any user to be authenticated by its credentialsvoid
setPopulationId
(String populationId) Set the value of the id of the population this user directory belong to.Methods inherited from class org.ametys.runtime.plugin.component.AbstractLogEnabled
getLogger, setLogger
-
Constructor Details
-
StaticUserDirectory
public StaticUserDirectory()
-
-
Method Details
-
getId
Description copied from interface:UserDirectory
A unique identifier- Specified by:
getId
in interfaceUserDirectory
- Returns:
- The non-null and non-empty identifier
-
getLabel
Description copied from interface:UserDirectory
Get the label of the CredentialProvider- Specified by:
getLabel
in interfaceUserDirectory
- Returns:
- The optionnal label
-
init
Description copied from interface:UserDirectory
Initialize the user's directory with given parameters' values.- Specified by:
init
in interfaceUserDirectory
- Parameters:
id
- The non-null and non-empty unique identifierudModelId
- The id of user directory extension pointparamValues
- The parameters' valueslabel
- The optional label
-
setPopulationId
Description copied from interface:UserDirectory
Set the value of the id of the population this user directory belong to.- Specified by:
setPopulationId
in interfaceUserDirectory
- 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 interfaceUserDirectory
- 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 interfaceUserDirectory
- Returns:
- the parameters' values
-
setGrantAllCredentials
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 theUserDirectoryModel
extension point- Specified by:
getUserDirectoryModelId
in interfaceUserDirectory
- 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 interfaceUserDirectory
- Returns:
- list of users as Collection of
User
s, empty if a problem occurs.
-
getUsers
Description copied from interface:UserDirectory
Get a list of users from a directory given the parameters- Specified by:
getUsers
in interfaceUserDirectory
- Parameters:
count
- The limit of users to retrieveoffset
- 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
Description copied from interface:UserDirectory
Get a particular user by his login.- Specified by:
getUser
in interfaceUserDirectory
- 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.- Specified by:
getUserByEmail
in interfaceUserDirectory
- 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
Description copied from interface:UserDirectory
Authenticate a user with its credentials- Specified by:
checkCredentials
in interfaceUserDirectory
- Parameters:
login
- The login to check. Cannot be null.password
- The password to check.- Returns:
- true if the user is authenticated, false otherwise.
-