@ThreadSafe public final class LoggedInUserManager extends com.helger.commons.scopes.singleton.GlobalSingleton implements ICurrentUserIDProvider
| Modifier and Type | Class and Description |
|---|---|
static class |
LoggedInUserManager.SessionUserHolder
This class manages the user ID of the current session.
|
| Modifier and Type | Field and Description |
|---|---|
static boolean |
DEFAULT_LOGOUT_ALREADY_LOGGED_IN_USER |
| Constructor and Description |
|---|
LoggedInUserManager()
Deprecated.
|
| Modifier and Type | Method and Description |
|---|---|
Set<String> |
getAllLoggedInUserIDs() |
Collection<LoginInfo> |
getAllLoginInfos() |
IUser |
getCurrentUser() |
String |
getCurrentUserID() |
static LoggedInUserManager |
getInstance() |
int |
getLoggedInUserCount() |
LoginInfo |
getLoginInfo(String sUserID)
Get the login details of the specified user.
|
com.helger.commons.callback.CallbackList<IUserLoginCallback> |
getUserLoginCallbacks() |
com.helger.commons.callback.CallbackList<IUserLogoutCallback> |
getUserLogoutCallbacks() |
boolean |
isCurrentUserAdministrator() |
boolean |
isLogoutAlreadyLoggedInUser() |
boolean |
isNoUserLoggedInInCurrentSession() |
boolean |
isUserLoggedIn(String sUserID)
Check if the specified user is logged in or not
|
boolean |
isUserLoggedInInCurrentSession() |
ELoginResult |
loginUser(IUser aUser,
String sPlainTextPassword,
Collection<String> aRequiredRoleIDs)
Login the passed user and require a set of certain roles, the used needs to
have to login here.
|
ELoginResult |
loginUser(String sLoginName,
String sPlainTextPassword)
Login the passed user without much ado.
|
ELoginResult |
loginUser(String sLoginName,
String sPlainTextPassword,
Collection<String> aRequiredRoleIDs)
Login the passed user and require a set of certain roles, the used needs to
have to login here.
|
com.helger.commons.state.EChange |
logoutCurrentUser()
Manually log out the current user
|
com.helger.commons.state.EChange |
logoutUser(String sUserID)
Manually log out the specified user
|
void |
setLogoutAlreadyLoggedInUser(boolean bLogoutAlreadyLoggedInUser) |
String |
toString() |
getAllGlobalSingletons, getGlobalSingleton, getGlobalSingletonIfInstantiated, isGlobalSingletonInstantiatedgetAllSingletons, getSingleton, getSingletonIfInstantiated, getSingletonScopeKey, isDestroyed, isInDestruction, isInInstantiation, isInstantiated, isSingletonInstantiated, isUsableObject, onAfterInstantiation, onDestroy, onScopeDestruction, readAbstractSingletonFields, setDestroyed, setInDestruction, setInInstantiation, setInstantiated, writeAbstractSingletonFieldspublic static final boolean DEFAULT_LOGOUT_ALREADY_LOGGED_IN_USER
@Deprecated @UsedViaReflection public LoggedInUserManager()
@Nonnull public static LoggedInUserManager getInstance()
null.@Nonnull @ReturnsMutableObject(reason="design") public com.helger.commons.callback.CallbackList<IUserLoginCallback> getUserLoginCallbacks()
null.@Nonnull @ReturnsMutableObject(reason="design") public com.helger.commons.callback.CallbackList<IUserLogoutCallback> getUserLogoutCallbacks()
null.public boolean isLogoutAlreadyLoggedInUser()
true if a new login of a user, destroys any previously
present session, false if a login should fail, if that
user is already logged in.public void setLogoutAlreadyLoggedInUser(boolean bLogoutAlreadyLoggedInUser)
@Nonnull public ELoginResult loginUser(@Nullable String sLoginName, @Nullable String sPlainTextPassword)
sLoginName - Login name of the user to log-in. May be null.sPlainTextPassword - Plain text password to use. May be null.null login status.@Nonnull public ELoginResult loginUser(@Nullable String sLoginName, @Nullable String sPlainTextPassword, @Nullable Collection<String> aRequiredRoleIDs)
sLoginName - Login name of the user to log-in. May be null.sPlainTextPassword - Plain text password to use. May be null.aRequiredRoleIDs - A set of required role IDs, the user needs to have. May be
null.null login status.@Nonnull public ELoginResult loginUser(@Nullable IUser aUser, @Nullable String sPlainTextPassword, @Nullable Collection<String> aRequiredRoleIDs)
aUser - The user to log-in. May be null. When the user is
null the login must fail.sPlainTextPassword - Plain text password to use. May be null.aRequiredRoleIDs - A set of required role IDs, the user needs to have. May be
null.null login status.@Nonnull public com.helger.commons.state.EChange logoutUser(@Nullable String sUserID)
sUserID - The user ID to log outEChange if something changed@Nonnull public com.helger.commons.state.EChange logoutCurrentUser()
EChange if something changedpublic boolean isUserLoggedIn(@Nullable String sUserID)
sUserID - The user ID to check. May be null.true if the user is logged in, false
otherwise.@Nonnull @ReturnsMutableCopy public Set<String> getAllLoggedInUserIDs()
null but maybe empty set with all currently
logged in user IDs.@Nullable public LoginInfo getLoginInfo(@Nullable String sUserID)
sUserID - The user ID to check. May be null.null if the passed user is not logged in.@Nonnull @ReturnsMutableCopy public Collection<LoginInfo> getAllLoginInfos()
null but maybe empty collection with the details
of all currently logged in users.@Nonnegative public int getLoggedInUserCount()
@Nullable public String getCurrentUserID()
getCurrentUserID in interface ICurrentUserIDProvidernull if
no user is logged in.public boolean isUserLoggedInInCurrentSession()
true if a user is currently logged into this session,
false otherwise. This is the inverse of
isNoUserLoggedInInCurrentSession().public boolean isNoUserLoggedInInCurrentSession()
true if not user is currently logged into this
session, false if it is. This is the inverse of
isUserLoggedInInCurrentSession().@Nullable public IUser getCurrentUser()
null if
no user is logged in.public boolean isCurrentUserAdministrator()
true if a user is logged in and is administratorpublic String toString()
toString in class com.helger.commons.scopes.AbstractSingletonCopyright © 2014–2015 Philip Helger. All rights reserved.