Package lumis.portal.authentication
Class AuthenticationManager
- java.lang.Object
-
- lumis.portal.authentication.AuthenticationManager
-
- All Implemented Interfaces:
IAuthenticationManager
public class AuthenticationManager extends Object implements IAuthenticationManager
Manager responsible for authenticating users and keeping session information.- Since:
- 4.0.0
- Version:
- $Revision: 22679 $ $Date: 2019-04-24 12:02:12 -0300 (Wed, 24 Apr 2019) $
-
-
Constructor Summary
Constructors Constructor Description AuthenticationManager()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description void
clearInactiveSessions(SessionConfig sessionConfig, int minutes, ITransaction transaction)
Deletes the sessions inactive for the specified amount of minutes.boolean
clearThreadData()
Clearssession config's
thread
data.void
endImpersonation(SessionConfig sessionConfig)
Ends an impersonation in the current thread, that has been started byIAuthenticationManager.impersonate(String)
.static String
generateSessionId()
Generates a new session identifier.Collection<SessionConfig>
getSessionsByUserId(SessionConfig sessionConfig, String userId, ITransaction transaction)
Returns a collection of active session objects for the given user.String
getUserIdBySessionId(SessionConfig sessionConfig, ITransaction transaction)
Deprecated.SessionConfig
impersonate(String userId)
The authenticated user in the current thread impersonates another user.void
keepSessionAlive(SessionConfig sessionConfig)
Keeps the specified session alive by updating the last time the session was used.SessionConfig
login(String securityAlias, String login, String password, ITransaction transaction)
Logins a user using the specified JAAS security alias, password as his credentials, and returns the new SessionConfig for the logged in user.SessionConfig
login(String login, String password, ITransaction transaction)
Logins a user using the specified password as his credentials, and returns the new SessionConfig for the logged in user.String
loginFramworkClockUser(ITransaction transaction)
Deprecated.String
loginUser(String login, String password, ITransaction transaction)
Deprecated.SessionConfig
loginUser(String userId, ITransaction transaction)
Logins a user without performing any authentication.String
loginUserGuest()
Deprecated.void
logoutUser(SessionConfig sessionConfig, ITransaction transaction)
Close the user's session given the userSession and the transaction.boolean
validateSessionId(SessionConfig sessionConfig, ITransaction transaction)
Validate the session of the User given the userSession and transaction.
-
-
-
Method Detail
-
validateSessionId
public boolean validateSessionId(SessionConfig sessionConfig, ITransaction transaction) throws ManagerException, PortalException
Description copied from interface:IAuthenticationManager
Validate the session of the User given the userSession and transaction. This method returns a boolean variable with True or False value- Specified by:
validateSessionId
in interfaceIAuthenticationManager
- Returns:
- true if the Session is valis and false otherwise.
- Throws:
ManagerException
PortalException
-
getUserIdBySessionId
@Deprecated public String getUserIdBySessionId(SessionConfig sessionConfig, ITransaction transaction) throws ManagerException, PortalException
Deprecated.Description copied from interface:IAuthenticationManager
Return the id of the user given the userSession.- Specified by:
getUserIdBySessionId
in interfaceIAuthenticationManager
- Returns:
- a String.
- Throws:
ManagerException
PortalException
-
loginFramworkClockUser
@Deprecated public String loginFramworkClockUser(ITransaction transaction) throws ManagerException, PortalException
Deprecated.Description copied from interface:IAuthenticationManager
Creates a session for the FrameworkClock user.- Specified by:
loginFramworkClockUser
in interfaceIAuthenticationManager
- Returns:
- Throws:
ManagerException
PortalException
-
loginUser
@Deprecated public String loginUser(String login, String password, ITransaction transaction) throws ManagerException, PortalException
Deprecated.Description copied from interface:IAuthenticationManager
Start the user's session given the login and password. This method returns the user's session configuration. Framework users like LumisFrameworkClockUser and LumisPageCacheUser cannot be authenticated through this method.- Specified by:
loginUser
in interfaceIAuthenticationManager
- Returns:
- a String.
- Throws:
ManagerException
PortalException
-
login
public SessionConfig login(String login, String password, ITransaction transaction) throws ManagerException, PortalException
Description copied from interface:IAuthenticationManager
Logins a user using the specified password as his credentials, and returns the new SessionConfig for the logged in user.- Specified by:
login
in interfaceIAuthenticationManager
- Parameters:
login
- the user's login.password
- the user's password.transaction
- the transaction for persistence access.- Returns:
- the created SessionConfig, or null if the login operation could not authenticate the user.
- Throws:
PortalException
ManagerException
- See Also:
IAuthenticationManager.loginUser(String, ITransaction)
-
login
public SessionConfig login(String securityAlias, String login, String password, ITransaction transaction) throws ManagerException, PortalException
Description copied from interface:IAuthenticationManager
Logins a user using the specified JAAS security alias, password as his credentials, and returns the new SessionConfig for the logged in user.- Specified by:
login
in interfaceIAuthenticationManager
- Parameters:
securityAlias
- the JAAS security alias to use. If null, the default security alias specified in the lumisportalconfig.xml file is used.login
- the user's login.password
- the user's password.transaction
- the transaction for persistence access.- Returns:
- the created SessionConfig, or null if the login operation could not authenticate the user.
- Throws:
PortalException
ManagerException
- See Also:
IAuthenticationManager.loginUser(String, ITransaction)
-
loginUser
public SessionConfig loginUser(String userId, ITransaction transaction) throws PortalException
Description copied from interface:IAuthenticationManager
Logins a user without performing any authentication.- Specified by:
loginUser
in interfaceIAuthenticationManager
- Parameters:
userId
- the userId.transaction
- the transaction for persistence access.- Throws:
PortalException
-
logoutUser
public void logoutUser(SessionConfig sessionConfig, ITransaction transaction) throws ManagerException, PortalException
Description copied from interface:IAuthenticationManager
Close the user's session given the userSession and the transaction.- Specified by:
logoutUser
in interfaceIAuthenticationManager
- Throws:
ManagerException
PortalException
-
loginUserGuest
@Deprecated public String loginUserGuest() throws ManagerException, PortalException
Deprecated.Description copied from interface:IAuthenticationManager
Add a guest session. This method returns the user's session configuration.- Specified by:
loginUserGuest
in interfaceIAuthenticationManager
- Returns:
- Returns a String.
- Throws:
ManagerException
PortalException
-
clearInactiveSessions
public void clearInactiveSessions(SessionConfig sessionConfig, int minutes, ITransaction transaction) throws ManagerException, PortalException
Description copied from interface:IAuthenticationManager
Deletes the sessions inactive for the specified amount of minutes.- Specified by:
clearInactiveSessions
in interfaceIAuthenticationManager
- Throws:
ManagerException
PortalException
-
keepSessionAlive
public void keepSessionAlive(SessionConfig sessionConfig) throws ManagerException, PortalException
Description copied from interface:IAuthenticationManager
Keeps the specified session alive by updating the last time the session was used.- Specified by:
keepSessionAlive
in interfaceIAuthenticationManager
- Throws:
ManagerException
PortalException
-
impersonate
public SessionConfig impersonate(String userId) throws PortalException
Description copied from interface:IAuthenticationManager
The authenticated user in the current thread impersonates another user. CallIAuthenticationManager.endImpersonation(SessionConfig)
to end an impersonation initiated by this method.- Specified by:
impersonate
in interfaceIAuthenticationManager
- Parameters:
userId
- the user id.- Returns:
- the impersonated SessionConfig.
- Throws:
PortalException
-
endImpersonation
public void endImpersonation(SessionConfig sessionConfig) throws PortalException
Description copied from interface:IAuthenticationManager
Ends an impersonation in the current thread, that has been started byIAuthenticationManager.impersonate(String)
.- Specified by:
endImpersonation
in interfaceIAuthenticationManager
- Parameters:
sessionConfig
- the impersonated session config.- Throws:
PortalException
-
getSessionsByUserId
public Collection<SessionConfig> getSessionsByUserId(SessionConfig sessionConfig, String userId, ITransaction transaction) throws PortalException
Description copied from interface:IAuthenticationManager
Returns a collection of active session objects for the given user. Guest and impersonated users are not considered active.- Specified by:
getSessionsByUserId
in interfaceIAuthenticationManager
- Returns:
- Throws:
PortalException
-
clearThreadData
public boolean clearThreadData()
Clearssession config's
thread
data.- Returns:
true
if there was data to be cleared orfalse
if the thread data was already clear.- Since:
- 6.0.0
-
generateSessionId
public static String generateSessionId()
Generates a new session identifier. Based onSecureRandom
, incremental integer and current time.- Returns:
- the generated session identifier.
- Since:
- 11.0.0
-
-