Class MemoryUsers
java.lang.Object
rife.authentication.credentialsmanagers.MemoryUsers
- All Implemented Interfaces:
CredentialsManager
,IdentifiableUsersManager
,RoleUsersManager
,PasswordEncrypting
public class MemoryUsers
extends Object
implements CredentialsManager, RoleUsersManager, PasswordEncrypting
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionaddUser
(String login, RoleUserAttributes attributes) void
boolean
containsRole
(String role) boolean
containsUser
(String login) long
long
getAttributes
(String login) Retrieves the attributes of a particular user according to its unique login.getLogin
(long userId) Retrieves the login of a particular user according to its unique ID.long
boolean
isUserInRole
(long userId, String role) boolean
boolean
listUserRoles
(String login, ListRoles processor) boolean
boolean
boolean
listUsersInRole
(ListUsers processor, String role) boolean
removeRole
(String name) boolean
removeUser
(long userId) boolean
removeUser
(String login) void
setPasswordEncryptor
(StringEncryptor passwordEncryptor) Sets the password encryptor to use to encrypt this credentials manager's passwords.boolean
updateUser
(String login, RoleUserAttributes attributes) long
verifyCredentials
(Credentials credentials) Verifies the validity of the providedCredentials
instance.
-
Field Details
-
passwordEncryptor_
-
-
Constructor Details
-
MemoryUsers
public MemoryUsers()
-
-
Method Details
-
getPasswordEncryptor
-
setPasswordEncryptor
Description copied from interface:PasswordEncrypting
Sets the password encryptor to use to encrypt this credentials manager's passwords.- Specified by:
setPasswordEncryptor
in interfacePasswordEncrypting
- Parameters:
passwordEncryptor
- the password encryptor that will be used
-
verifyCredentials
Description copied from interface:CredentialsManager
Verifies the validity of the providedCredentials
instance.- Specified by:
verifyCredentials
in interfaceCredentialsManager
- Parameters:
credentials
- TheCredentials
instance that needs to be verified.- Returns:
- A
long
that uniquely identifies the user that corresponds to the validated credentials; or-1
if the credentials are invalid. - Throws:
CredentialsManagerException
- An undefined number of exceptional cases or error situations can occur when credentials are verified. They are all indicated by throwing an instance ofCredentialsManagerException
. It's up to the implementations of this interface to give more specific meanings to these exceptions.
-
addRole
- Specified by:
addRole
in interfaceRoleUsersManager
- Throws:
CredentialsManagerException
-
countRoles
public long countRoles()- Specified by:
countRoles
in interfaceRoleUsersManager
-
containsRole
- Specified by:
containsRole
in interfaceRoleUsersManager
-
addUser
public MemoryUsers addUser(String login, RoleUserAttributes attributes) throws CredentialsManagerException - Specified by:
addUser
in interfaceRoleUsersManager
- Throws:
CredentialsManagerException
-
getAttributes
Description copied from interface:IdentifiableUsersManager
Retrieves the attributes of a particular user according to its unique login.- Specified by:
getAttributes
in interfaceIdentifiableUsersManager
- Parameters:
login
- the login of the user whose attributes need to be retrieved- Returns:
- the requested user attributes; or
null
if the user couldn't be found
-
countUsers
public long countUsers()- Specified by:
countUsers
in interfaceRoleUsersManager
-
listRoles
- Specified by:
listRoles
in interfaceRoleUsersManager
-
listUsers
- Specified by:
listUsers
in interfaceRoleUsersManager
-
listUsers
- Specified by:
listUsers
in interfaceRoleUsersManager
-
containsUser
- Specified by:
containsUser
in interfaceRoleUsersManager
-
listUsersInRole
- Specified by:
listUsersInRole
in interfaceRoleUsersManager
- Throws:
CredentialsManagerException
-
isUserInRole
- Specified by:
isUserInRole
in interfaceRoleUsersManager
-
getLogin
Description copied from interface:IdentifiableUsersManager
Retrieves the login of a particular user according to its unique ID.- Specified by:
getLogin
in interfaceIdentifiableUsersManager
- Parameters:
userId
- the ID of the user whose login will be retrieved- Returns:
- the requested user login; or
null
if the user couldn't be found
-
getUserId
- Specified by:
getUserId
in interfaceRoleUsersManager
-
updateUser
public boolean updateUser(String login, RoleUserAttributes attributes) throws CredentialsManagerException - Specified by:
updateUser
in interfaceRoleUsersManager
- Throws:
CredentialsManagerException
-
removeUser
- Specified by:
removeUser
in interfaceRoleUsersManager
-
removeUser
public boolean removeUser(long userId) - Specified by:
removeUser
in interfaceRoleUsersManager
-
removeRole
- Specified by:
removeRole
in interfaceRoleUsersManager
-
clearUsers
public void clearUsers()- Specified by:
clearUsers
in interfaceRoleUsersManager
-
listUserRoles
- Specified by:
listUserRoles
in interfaceRoleUsersManager
- Throws:
CredentialsManagerException
-