Package com.gigaspaces.security.fs
Class FileUserManager
java.lang.Object
com.gigaspaces.security.fs.FileUserManager
- All Implemented Interfaces:
UserManager
A file based
UserManager responsible for managing users stored in a file. The file is
read on construction and written to on the call to #close(). A UserDetails
password is encrypted using the defined PasswordEncoder. The encoded password is set,
assuming that UserDetails has a setPassword(String) method. If one isn't
declared an exception is thrown.
- Since:
- 7.0.1
- Author:
- Moran Avigdor
-
Constructor Summary
ConstructorsConstructorDescriptionFileUserManager(FileServiceAccessor fileServiceAccessor, boolean isReadOnly) -
Method Summary
Modifier and TypeMethodDescriptionvoidcreateUser(UserDetails userDetails) Create a new user with the specifieduserDetails.voiddeleteUser(String username) Delete an existing user represented by the specifiedusername.Retrieve the user details byusername.booleanIndicates that this manager is for read-only purposes, and that any invocation of a destructive operation will throw anAccessDeniedException.mapUsers()Returns a map containing mapping between username and user-details.voidupdateUser(UserDetails userDetails) Updates the user details, excluding the username which must remain the same.booleanuserExists(String username) Queries for presence of a user by username.
-
Constructor Details
-
FileUserManager
-
-
Method Details
-
isReadOnly
public boolean isReadOnly()Description copied from interface:UserManagerIndicates that this manager is for read-only purposes, and that any invocation of a destructive operation will throw anAccessDeniedException.- Specified by:
isReadOnlyin interfaceUserManager- Returns:
trueif read-only access is allowed.
-
createUser
public void createUser(UserDetails userDetails) throws UserAlreadyExistsException, UserDataAccessException, AccessDeniedException Description copied from interface:UserManagerCreate a new user with the specifieduserDetails.- Specified by:
createUserin interfaceUserManager- Parameters:
userDetails- new user details to store.- Throws:
UserAlreadyExistsException- if the user details represent a non-unique userUserDataAccessException- if could not store the specified user details.AccessDeniedException- if read-only access is allowed.
-
deleteUser
public void deleteUser(String username) throws UserNotFoundException, UserDataAccessException, AccessDeniedException Description copied from interface:UserManagerDelete an existing user represented by the specifiedusername.- Specified by:
deleteUserin interfaceUserManager- Parameters:
username- an existing user name.- Throws:
UserNotFoundException- if the user was not found.UserDataAccessException- if could not delete the specified user details.AccessDeniedException- if read-only access is allowed.
-
getUser
Description copied from interface:UserManagerRetrieve the user details byusername.- Specified by:
getUserin interfaceUserManager- Parameters:
username- an existing user to retrieve.- Returns:
- the user details of the specified user.
- Throws:
UserNotFoundException- if the user was not found.UserDataAccessException- if could not retrieve the specified user details.
-
mapUsers
Description copied from interface:UserManagerReturns a map containing mapping between username and user-details.- Specified by:
mapUsersin interfaceUserManager- Returns:
- a mapping between username and user-details.
- Throws:
UserDataAccessException- if could not retrieve user-details to map.
-
updateUser
public void updateUser(UserDetails userDetails) throws UserNotFoundException, UserDataAccessException Description copied from interface:UserManagerUpdates the user details, excluding the username which must remain the same. In order to update a username, a user must be removed and re-created. A password on the other hand, may require encryption, only if it was modified.- Specified by:
updateUserin interfaceUserManager- Parameters:
userDetails- the user details to update.- Throws:
UserNotFoundException- if the user was not found.UserDataAccessException- if could not update the user details.
-
userExists
Description copied from interface:UserManagerQueries for presence of a user by username.- Specified by:
userExistsin interfaceUserManager- Parameters:
username- the user to check existence for.- Returns:
trueif the user exists;falseotherwise.- Throws:
UserDataAccessException- if could not query for the specified user.
-