public class ProfileManager<U extends CommonProfile> extends Object
Modifier and Type | Field and Description |
---|---|
protected WebContext |
context |
Constructor and Description |
---|
ProfileManager(WebContext context) |
Modifier and Type | Method and Description |
---|---|
Optional<U> |
get(boolean readFromSession)
Retrieve the first user profile if it exists, ignoring any
AnonymousProfile if possible. |
List<U> |
getAll(boolean readFromSession)
Retrieve all user profiles.
|
boolean |
isAuthenticated()
Tests if the current user is authenticated (meaning a user profile exists which is not an
AnonymousProfile ). |
void |
logout()
Perform a logout by removing the current user profile(s).
|
void |
remove(boolean removeFromSession)
Remove the current user profile(s).
|
protected LinkedHashMap<String,U> |
retrieveAll(boolean readFromSession)
Retrieve the map of profiles from the session or the request.
|
protected String |
retrieveClientName(U profile) |
void |
save(boolean saveInSession,
U profile,
boolean multiProfile)
Save the given user profile (replace the current one if multi profiles are not supported, add it otherwise).
|
protected final WebContext context
public ProfileManager(WebContext context)
public Optional<U> get(boolean readFromSession)
AnonymousProfile
if possible.readFromSession
- if the user profile must be read from sessionpublic List<U> getAll(boolean readFromSession)
readFromSession
- if the user profiles must be read from sessionprotected LinkedHashMap<String,U> retrieveAll(boolean readFromSession)
readFromSession
- if the user profiles must be read from sessionpublic void remove(boolean removeFromSession)
removeFromSession
- if the user profile(s) must be removed from sessionpublic void save(boolean saveInSession, U profile, boolean multiProfile)
saveInSession
- if the user profile must be saved in sessionprofile
- a given user profilemultiProfile
- whether multiple profiles are supportedpublic void logout()
public boolean isAuthenticated()
AnonymousProfile
).Copyright © 2018. All rights reserved.