public class ProfileManager<U extends UserProfile> extends Object
This class is a generic way to manage the current user profile, i.e. the one of the current authenticated user.
It may be partially re-implemented for specific needs / frameworks.
Modifier and Type | Field and Description |
---|---|
protected WebContext |
context |
Constructor and Description |
---|
ProfileManager(WebContext context) |
Modifier and Type | Method and Description |
---|---|
U |
get(boolean readFromSession)
Retrieve the current user profile (from request first and then from the session if not found and requested).
|
boolean |
isAuthenticated()
Tests if the current is authenticated (meaning a user profile exists).
|
void |
logout()
Perform a logout by removing the current user profile from the session as well.
|
void |
remove(boolean removeFromSession)
Remove the current user profile.
|
void |
save(boolean saveInSession,
U profile)
Save the given user profile as the current one.
|
protected final WebContext context
public ProfileManager(WebContext context)
public U get(boolean readFromSession)
readFromSession
- if the user profile must be read from sessionpublic void remove(boolean removeFromSession)
removeFromSession
- if the user profile must be removed from sessionpublic void save(boolean saveInSession, U profile)
saveInSession
- if the user profile must be saved in sessionprofile
- a given user profilepublic void logout()
public boolean isAuthenticated()
Copyright © 2016. All rights reserved.