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
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionaddUser(String login, RoleUserAttributes attributes) voidbooleancontainsRole(String role) booleancontainsUser(String login) longlonggetAttributes(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.longbooleanisUserInRole(long userId, String role) booleanbooleanlistUserRoles(String login, ListRoles processor) booleanbooleanbooleanlistUsersInRole(ListUsers processor, String role) booleanremoveRole(String name) booleanremoveUser(long userId) booleanremoveUser(String login) voidsetPasswordEncryptor(StringEncryptor passwordEncryptor) Sets the password encryptor to use to encrypt this credentials manager's passwords.booleanupdateUser(String login, RoleUserAttributes attributes) longverifyCredentials(Credentials credentials) Verifies the validity of the providedCredentialsinstance.
-
Field Details
-
passwordEncryptor_
-
-
Constructor Details
-
MemoryUsers
public MemoryUsers()
-
-
Method Details
-
getPasswordEncryptor
-
setPasswordEncryptor
Description copied from interface:PasswordEncryptingSets the password encryptor to use to encrypt this credentials manager's passwords.- Specified by:
setPasswordEncryptorin interfacePasswordEncrypting- Parameters:
passwordEncryptor- the password encryptor that will be used
-
verifyCredentials
Description copied from interface:CredentialsManagerVerifies the validity of the providedCredentialsinstance.- Specified by:
verifyCredentialsin interfaceCredentialsManager- Parameters:
credentials- TheCredentialsinstance that needs to be verified.- Returns:
- A
longthat uniquely identifies the user that corresponds to the validated credentials; or-1if 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:
addRolein interfaceRoleUsersManager- Throws:
CredentialsManagerException
-
countRoles
public long countRoles()- Specified by:
countRolesin interfaceRoleUsersManager
-
containsRole
- Specified by:
containsRolein interfaceRoleUsersManager
-
addUser
public MemoryUsers addUser(String login, RoleUserAttributes attributes) throws CredentialsManagerException - Specified by:
addUserin interfaceRoleUsersManager- Throws:
CredentialsManagerException
-
getAttributes
Description copied from interface:IdentifiableUsersManagerRetrieves the attributes of a particular user according to its unique login.- Specified by:
getAttributesin interfaceIdentifiableUsersManager- Parameters:
login- the login of the user whose attributes need to be retrieved- Returns:
- the requested user attributes; or
nullif the user couldn't be found
-
countUsers
public long countUsers()- Specified by:
countUsersin interfaceRoleUsersManager
-
listRoles
- Specified by:
listRolesin interfaceRoleUsersManager
-
listUsers
- Specified by:
listUsersin interfaceRoleUsersManager
-
listUsers
- Specified by:
listUsersin interfaceRoleUsersManager
-
containsUser
- Specified by:
containsUserin interfaceRoleUsersManager
-
listUsersInRole
- Specified by:
listUsersInRolein interfaceRoleUsersManager- Throws:
CredentialsManagerException
-
isUserInRole
- Specified by:
isUserInRolein interfaceRoleUsersManager
-
getLogin
Description copied from interface:IdentifiableUsersManagerRetrieves the login of a particular user according to its unique ID.- Specified by:
getLoginin interfaceIdentifiableUsersManager- Parameters:
userId- the ID of the user whose login will be retrieved- Returns:
- the requested user login; or
nullif the user couldn't be found
-
getUserId
- Specified by:
getUserIdin interfaceRoleUsersManager
-
updateUser
public boolean updateUser(String login, RoleUserAttributes attributes) throws CredentialsManagerException - Specified by:
updateUserin interfaceRoleUsersManager- Throws:
CredentialsManagerException
-
removeUser
- Specified by:
removeUserin interfaceRoleUsersManager
-
removeUser
public boolean removeUser(long userId) - Specified by:
removeUserin interfaceRoleUsersManager
-
removeRole
- Specified by:
removeRolein interfaceRoleUsersManager
-
clearUsers
public void clearUsers()- Specified by:
clearUsersin interfaceRoleUsersManager
-
listUserRoles
- Specified by:
listUserRolesin interfaceRoleUsersManager- Throws:
CredentialsManagerException
-