Package com.microstrategy.web.app
Interface WebAppSessionManager
-
- All Superinterfaces:
EnumWebPersistableState
,Persistable
,RequestPersistable
,WebSessionManager
- All Known Implementing Classes:
ServerAdminSessionManager
,WebAppSessionManagerImpl
public interface WebAppSessionManager extends WebSessionManager
This is the interface for the MicroStrategy Web session manager. This interface contains methods for all session management related functionality. It maintains aWebIServerSessionList
ofWebIServerSession
objects. It has an active session, which is the session that all requests will be directed to.Note that the standard calls that should be called on every page are restoreStateFromRequest and initActiveSessionFromRequest. These will ensure that the active session is set up to reflect any information passed in the state or saved in session variables or cookies. If a live session is expected, the validateSession method should be called after the above methods to ensure that the active session is live.
- Since:
- MicroStrategy Web 8.0.1
-
-
Field Summary
-
Fields inherited from interface com.microstrategy.utils.serialization.EnumWebPersistableState
BARE_MINIMAL_STATE_INFO, MAXIMAL_STATE_INFO, MINIMAL_STATE_INFO, TYPICAL_STATE_INFO
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description int
buildLastMessageKey(java.lang.String... serverName)
Create a GUID that is a combination of server/project info in order to maintain a keyed list of last message across server/project at client-side.void
changeLocale()
Changes the locale on all sessions in a cluster with the active one to the setting which is set on the session's preferences.void
changePassword(java.lang.String oldP, java.lang.String newP)
Changes the active session's password from the old password given to the new password.void
changeSessionFlags()
Changes the session flags for the session.WebIServerSession
createLoginFirstSession()
Creates a Login First sessionint
getAvailableAuthModes(WebIServerSession session)
Returns the available authentication modes that may be used with this session.int
getAvailableWebLoginModes(WebIServerSession session)
Returns the available web login modes that may be used with this session.java.lang.String
getKey()
Returns the key of the Session Manager.int
getLastMessageKey()
Get cached message key that matches the last message idjava.lang.String
getLastMsgIDFromCookie(int lastMsgKey)
Get last message ID based on given last message keyWebIServerSession
getLoginFirstSession()
Returns the existing Login First session (already created or restored).java.util.ArrayList
getProjectsList()
Returns an ArrayList ofProjectInformation
objects, which contain information about the projects we are connected to.java.util.ArrayList
getProjectsList(boolean refresh)
Returns an ArrayList ofProjectInformation
objects, which contain information about the projects we are connected to.WebIServerSession
getSession(java.lang.String server, int port, java.lang.String project)
Returns theWebIServerSession
for the given server/project.java.lang.String
getUserName()
Attempts to retrieve a printable user name for either the active session, or, if loginFirst is true, the credentials set on the Session Manager will be used to obtain the user name.boolean
hasCredentials()
Returns whether this instance of the session manager contains credentials internally.WebIServerSession
initActiveSessionFromRequest()
This method will examine the request, and attempt to either set the active session properly, or create a brand new session that will become the active session, if the request asks for a session on a server without a session and project already created on it.WebIServerSession
initActiveSessionFromRequest(ServletWebComponent component)
This method will examine the request, and attempt to either set the active session properly, or create a brand new session that will become the active session, if the request asks for a session on a server without a session and project already created on it.WebIServerSession
initActiveSessionFromRequest(ServletWebComponent component, boolean doNotInvalidateSession)
This method will examine the request, and attempt to either set the active session properly, or create a brand new session that will become the active session, if the request asks for a session on a server without a session and project already created on it.boolean
isAdminUser()
Returns whether the active session's user is an administrative user or not.boolean
isLoginFirstEnabled()
boolean
isSSOLoging()
boolean
needNewPswd()
Returns whether the user needs to update password or not.void
removeActiveSession()
Removes the active session from the list, closing it if the external security manager setup on the application context says to do so.void
removeAllSessions()
Removes all sessions from the list, closing them if the external security manager setup on the application context says to do so.void
setCredentials(java.lang.String uid, java.lang.String p, int authMode)
Sets the credentials for the active session.void
updateActiveSession(WebIServerSession wiss)
Sets passed session as the existing active sessionvoid
validateSession()
This method attempts to validate the active session.void
validateSession(boolean refresh)
This method attempts to validate the active session.void
validateSession(WebIServerSession session)
This method attempts to validate the given session.-
Methods inherited from interface com.microstrategy.utils.serialization.Persistable
restoreState, restoreState, saveState, saveState, saveState, saveState
-
Methods inherited from interface com.microstrategy.web.beans.RequestPersistable
restoreStateFromRequest, restoreStateFromRequest
-
Methods inherited from interface com.microstrategy.web.beans.WebSessionManager
getActiveSession, getSessionList, initActiveSessionFromRequestKeys, setActiveSession
-
-
-
-
Method Detail
-
changeLocale
void changeLocale()
Changes the locale on all sessions in a cluster with the active one to the setting which is set on the session's preferences. This method will look at those preferences, and if they do not match the locale on the session, change the session locale, if we have enough information to recreate the session.
-
changeSessionFlags
void changeSessionFlags()
Changes the session flags for the session. This method will check the user session's prefrerences for the session and all sessions in the same cluster of servers, and if the current session flags are not the same as the session flags in the preferences, the session flags will be changed, if there exists enough information to recreate the session.
-
changePassword
void changePassword(java.lang.String oldP, java.lang.String newP) throws WebAppException
Changes the active session's password from the old password given to the new password.- Parameters:
oldP
- The old password. Needed to confirm the correct user's identity.newP
- The new password.- Throws:
WebAppException
- Thrown if an error occurs when attempting to change password.
-
getSession
WebIServerSession getSession(java.lang.String server, int port, java.lang.String project)
Returns theWebIServerSession
for the given server/project. Will return null if the server is not connected (or cannot be auto-connected). It will also be made the current session.- Returns:
- The current active session.
- Since:
- MicroStrategy Web 9.0.0
-
isAdminUser
boolean isAdminUser()
Returns whether the active session's user is an administrative user or not. This is checked via checking privileges.- Returns:
- True if the active session's user has administrative privileges, false otherwise.
-
getProjectsList
java.util.ArrayList getProjectsList() throws WebAppException
Returns an ArrayList ofProjectInformation
objects, which contain information about the projects we are connected to. This method is the same as getProjectList(false).- Returns:
- An ArrayList of
ProjectInformation
objects. - Throws:
WebAppException
- Thrown if an error occurs.- See Also:
getProjectsList(boolean)
-
getProjectsList
java.util.ArrayList getProjectsList(boolean refresh) throws WebAppException
Returns an ArrayList ofProjectInformation
objects, which contain information about the projects we are connected to.- Parameters:
refresh
- A boolean variable indicates whether we should refresh the project list. If this parameter is false, and there is cached result of this call, we will return the last result, or throw the same exception as last time. If this parameter is true, we will ingore the cache and refresh the project list.- Returns:
- An ArrayList of
ProjectInformation
objects. - Throws:
WebAppException
- Thrown if an error occurs.- Since:
- MicroStrategy Web 8.0.2
-
removeAllSessions
void removeAllSessions()
Removes all sessions from the list, closing them if the external security manager setup on the application context says to do so.
-
removeActiveSession
void removeActiveSession()
Removes the active session from the list, closing it if the external security manager setup on the application context says to do so.
-
validateSession
void validateSession() throws WebAppException
This method attempts to validate the active session. If the session cannot be validated, then it can also attempt to recover for a specific set of error conditions. If the session cannot be validated or recovered, this method will throw an exception. If an exception is not thrown, then the session is valid. If there is result of previous validateSession call, it will not re-do the validation, install just returns the same validation result. If you need do the validation regardless the previous result, usevalidateSession(boolean)
passing true as parameter.- Throws:
WebAppException
- Thrown if the active session is confirmed to be invalid.
-
validateSession
void validateSession(boolean refresh) throws WebAppException
This method attempts to validate the active session. If the session cannot be validated, then it can also attempt to recover for a specific set of error conditions. If the session cannot be validated or recovered, this method will throw an exception. If an exception is not thrown, then the session is valid.- Parameters:
refresh
- The boolean vairable indicates whether we should use previous validation result. If this is false and there is result of previous validateSession call, it will not re-do the validation, install just returns the same validation result. Eitherwise, it will do the validation process.- Throws:
WebAppException
- Thrown if the active session is confirmed to be invalid.- Since:
- MicroStrategy Web 8.0.2
-
validateSession
void validateSession(WebIServerSession session) throws WebAppException
This method attempts to validate the given session. If the session cannot be validated, then it can also attempt to recover for a specific set of error conditions. If the session cannot be validated or recovered, this method will throw an exception. If an exception is not thrown, then the session is valid.- Parameters:
session
- The session to validate.- Throws:
WebAppException
- Thrown if the active session is confirmed to be invalid.- Since:
- MicroStrategy Web 9.0.0
-
initActiveSessionFromRequest
WebIServerSession initActiveSessionFromRequest() throws WebAppException
This method will examine the request, and attempt to either set the active session properly, or create a brand new session that will become the active session, if the request asks for a session on a server without a session and project already created on it.- Returns:
- The WebIServerSession that is active after the call. This session is the one that is requested to be used by the variables passed as part of the request.
- Throws:
WebAppException
- Thrown if an error occurs.
-
initActiveSessionFromRequest
WebIServerSession initActiveSessionFromRequest(ServletWebComponent component) throws WebAppException
This method will examine the request, and attempt to either set the active session properly, or create a brand new session that will become the active session, if the request asks for a session on a server without a session and project already created on it. Note that this method will, if a key or server/project/port is not found in the request, check with the ServletWebComponent to see what the current server/project/port is. This will return null if no server is specified, or the server is not connected (or cannot be auto-connected).- Parameters:
component
- AServletWebComponent
object representing the servlet, which can be queried for the server, project, and port for the current request.- Returns:
- The WebIServerSession that is active after the call. This session is the one that is requested to be used by the variables passed as part of the request.
- Throws:
WebAppException
- Thrown if an error occurs.
-
initActiveSessionFromRequest
WebIServerSession initActiveSessionFromRequest(ServletWebComponent component, boolean doNotInvalidateSession) throws WebAppException
This method will examine the request, and attempt to either set the active session properly, or create a brand new session that will become the active session, if the request asks for a session on a server without a session and project already created on it. Note that this method will, if a key or server/project/port is not found in the request, check with the ServletWebComponent to see what the current server/project/port is. This will return null if no server is specified, or the server is not connected (or cannot be auto-connected).- Parameters:
component
- AServletWebComponent
object representing the servlet, which can be queried for the server, project, and port for the current request.doNotInvalidateSession
- a flag to indacate whether to invalidate Session. Can be passed by AppTaskRequestContext- Returns:
- The WebIServerSession that is active after the call. This session is the one that is requested to be used by the variables passed as part of the request.
- Throws:
WebAppException
- Thrown if an error occurs.
-
setCredentials
void setCredentials(java.lang.String uid, java.lang.String p, int authMode) throws WebAppException
Sets the credentials for the active session. If the login first functionality is enabled, then these credentials will be kept around until overridden and used for every session.- Parameters:
uid
- The user ID of the loginp
- The password of the loginauthMode
- The authentication mode of the credentials, fromEnumDSSXMLAuthModes
.- Throws:
WebAppException
- Thrown if an error occurs.
-
hasCredentials
boolean hasCredentials()
Returns whether this instance of the session manager contains credentials internally. This will be true if setCredentials has been called since the creation or deserialization of this SessionManager object, or if loginFirst is true and the credentials have ever been set.- Returns:
- True if the session manager has credentials associated with it, false otherwise.
-
getUserName
java.lang.String getUserName()
Attempts to retrieve a printable user name for either the active session, or, if loginFirst is true, the credentials set on the Session Manager will be used to obtain the user name.- Returns:
- The user name for the user of the session manager.
-
getAvailableAuthModes
int getAvailableAuthModes(WebIServerSession session) throws WebAppException
Returns the available authentication modes that may be used with this session. A project name or ID (along with the residing server) should be specified prior to making this call if the intented login is to a project since authentication modes may be project specific.- Returns:
- the available authentication modes that may be used with this session.
- Throws:
WebAppException
- thrown if there was a problem getting the authentication modes.- Since:
- MicroStrategy Web 9.0.0
-
getAvailableWebLoginModes
int getAvailableWebLoginModes(WebIServerSession session) throws WebAppException
Returns the available web login modes that may be used with this session. A project name or ID (along with the residing server) should be specified prior to making this call if the intented login is to a project since web login modes may be project specific.- Returns:
- the available web login modes that may be used with this session.
- Throws:
WebAppException
- thrown if there was a problem getting the web lgoin modes.
-
getKey
java.lang.String getKey()
Returns the key of the Session Manager. This value is used to store and retrieve the state of the Session Manager.- Since:
- MicroStrategy Web 9.0.0
-
needNewPswd
boolean needNewPswd()
Returns whether the user needs to update password or not.- Returns:
- true if new password is needed.
-
updateActiveSession
void updateActiveSession(WebIServerSession wiss) throws WebObjectsException
Sets passed session as the existing active session- Parameters:
wiss
- the new IServer session- Throws:
WebObjectsException
-
buildLastMessageKey
int buildLastMessageKey(java.lang.String... serverName)
Create a GUID that is a combination of server/project info in order to maintain a keyed list of last message across server/project at client-side.- Returns:
- {int}
-
getLastMessageKey
int getLastMessageKey()
Get cached message key that matches the last message id- Returns:
-
getLastMsgIDFromCookie
java.lang.String getLastMsgIDFromCookie(int lastMsgKey)
Get last message ID based on given last message key- Returns:
- {String}
-
createLoginFirstSession
WebIServerSession createLoginFirstSession() throws WebAppException
Creates a Login First session- Returns:
- Login First session
- Throws:
WebAppException
-
getLoginFirstSession
WebIServerSession getLoginFirstSession() throws WebAppException
Returns the existing Login First session (already created or restored). If there is no login first session yet, it will create one and return it.- Returns:
- Login First session
- Throws:
WebAppException
-
isLoginFirstEnabled
boolean isLoginFirstEnabled()
-
isSSOLoging
boolean isSSOLoging()
-
-