Package com.gigaspaces.security.fs
Class FileServiceAccessor
java.lang.Object
com.gigaspaces.security.fs.FileServiceAccessor
An internal accessor on top of a
FileService, holding a file-content cache, and the
encoding manager. Is used to load a user, and populate it with roles.- Since:
- 7.0.1
- Author:
- Moran Avigdor
-
Constructor Summary
ConstructorsConstructorDescriptionFileServiceAccessor(FileService fileService, FileEncodingManager fileEncodingManager) -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()loadUserByUsername(String username) Locates the user by username, returning a fully populated user record (including authorities normalized from their role representation).
-
Constructor Details
-
FileServiceAccessor
public FileServiceAccessor(FileService fileService, FileEncodingManager fileEncodingManager) throws IOException - Throws:
IOException
-
-
Method Details
-
loadUserByUsername
public UserDetails loadUserByUsername(String username) throws UserNotFoundException, UserDataAccessException, RoleNotFoundException, RoleDataAccessException, IOException Locates the user by username, returning a fully populated user record (including authorities normalized from their role representation).A role is represented by
RoleAuthority. Commonly, a roles' authorities need to be extracted from a 'roles-table'. To fully populate the user record, the authorities represented by this role need to be added to the authorities returned byUserDetails.getAuthorities(). Thus, the returned user record is normalized to include all authorities regardless of the implementation details.Of course, when normalizing we immediately loose the notion of a role. For presentation purposes, we might want to keep this distinction. A
PopulatedRoleAuthoritymay be used to aggregate all the authorities represented by this role. It can be added as anAuthorityto the authorities returned byUserDetails.getAuthorities().- Parameters:
username- the user name represented as part of the authentication request.- Returns:
- a fully populated user record (never null).
- Throws:
UserNotFoundException- if the user can not be found.UserDataAccessException- if an exception was thrown accessing a user record.RoleNotFoundException- if the role associated to this user can not be found.RoleDataAccessException- if an exception was thrown accessing a role record.IOException
-
close
- Throws:
IOException
-
getFileEncodingManager
- Returns:
- the fileEncodingManager
-
getFileContent
- Returns:
- the fileContent
-