public class FileServiceAccessor extends Object
FileService
, holding a file-content cache, and the
encoding manager. Is used to load a user, and populate it with roles.Constructor and Description |
---|
FileServiceAccessor(FileService fileService,
FileEncodingManager fileEncodingManager) |
Modifier and Type | Method and Description |
---|---|
void |
close() |
FileContent |
getFileContent() |
FileEncodingManager |
getFileEncodingManager() |
UserDetails |
loadUserByUsername(String username)
Locates the user by username, returning a fully populated user record (including authorities
normalized from their role representation).
|
public FileServiceAccessor(FileService fileService, FileEncodingManager fileEncodingManager) throws IOException
IOException
public UserDetails loadUserByUsername(String username) throws UserNotFoundException, UserDataAccessException, RoleNotFoundException, RoleDataAccessException, IOException
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 by UserDetails.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 PopulatedRoleAuthority
may be
used to aggregate all the authorities represented by this role. It can be added as an Authority
to the authorities returned by UserDetails.getAuthorities()
.
username
- the user name represented as part of the authentication request.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
public void close() throws IOException
IOException
public FileEncodingManager getFileEncodingManager()
public FileContent getFileContent()
Copyright © GigaSpaces.