public class StaticUserDirectory extends AbstractLogEnabled implements UserDirectory, Component
Modifier and Type | Field and Description |
---|---|
private static String |
__PARAM_USERS |
private boolean |
_grantAllCredentials |
private String |
_id |
private String |
_label |
private Map<String,Object> |
_paramValues |
private String |
_populationId |
private Map<String,User> |
_staticUsers |
private String |
_udModelId |
Constructor and Description |
---|
StaticUserDirectory() |
Modifier and Type | Method and Description |
---|---|
private User |
_createUser(String userLine) |
private boolean |
_isLike(User user,
String pattern) |
boolean |
checkCredentials(String login,
String password)
Authenticate a user with its credentials
|
String |
getId()
A unique identifier
|
String |
getLabel()
Get the label of the CredentialProvider
|
Map<String,Object> |
getParameterValues()
Get the values of parameters (from user directory model)
|
String |
getPopulationId()
Get the id of the population this user directory belongs to.
|
User |
getUser(String login)
Get a particular user by his login.
|
String |
getUserDirectoryModelId()
Get the id of the
UserDirectoryModel extension point |
Collection<User> |
getUsers()
Get the list of all users of one directory.
|
List<User> |
getUsers(int count,
int offset,
Map<String,Object> parameters)
Get a list of users from a directory given the parameters
|
void |
init(String id,
String udModelId,
Map<String,Object> paramValues,
String label)
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 credentials
|
void |
setPopulationId(String populationId)
Set the value of the id of the population this user directory belong to.
|
getLogger, setLogger
private static final String __PARAM_USERS
private Map<String,User> _staticUsers
private String _udModelId
private Map<String,Object> _paramValues
private String _populationId
private boolean _grantAllCredentials
public StaticUserDirectory()
public String getId()
UserDirectory
getId
in interface UserDirectory
public String getLabel()
UserDirectory
getLabel
in interface UserDirectory
public void init(String id, String udModelId, Map<String,Object> paramValues, String label)
UserDirectory
init
in interface UserDirectory
id
- The non-null and non-empty unique identifierudModelId
- The id of user directory extension pointparamValues
- The parameters' valueslabel
- The optional labelpublic void setPopulationId(String populationId)
UserDirectory
setPopulationId
in interface UserDirectory
populationId
- The id of the population the user directory belongs to.public String getPopulationId()
UserDirectory
getPopulationId
in interface UserDirectory
public Map<String,Object> getParameterValues()
UserDirectory
getParameterValues
in interface UserDirectory
public void setGrantAllCredentials(boolean grantAllCredentials)
grantAllCredentials
- true if the directory should grant all call to checkCredentialspublic String getUserDirectoryModelId()
UserDirectory
UserDirectoryModel
extension pointgetUserDirectoryModelId
in interface UserDirectory
public Collection<User> getUsers()
UserDirectory
getUsers
in interface UserDirectory
User
s, empty if a problem occurs.public List<User> getUsers(int count, int offset, Map<String,Object> parameters)
UserDirectory
getUsers
in interface UserDirectory
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.User
public User getUser(String login)
UserDirectory
getUser
in interface UserDirectory
login
- Login of the user to get. Cannot be null.User
instance or null if the user login does not exist.public boolean checkCredentials(String login, String password)
UserDirectory
checkCredentials
in interface UserDirectory
login
- The login to check. Cannot be null.password
- The password to check.private User _createUser(String userLine)