Package org.opencms.jsp
Class CmsJspLoginPersistingBean
java.lang.Object
org.opencms.jsp.CmsJspBean
org.opencms.jsp.CmsJspActionElement
org.opencms.jsp.CmsJspLoginBean
org.opencms.jsp.CmsJspLoginPersistingBean
Login bean which sets a cookie that can be used by
CmsPersistentLoginAuthorizationHandler to automatically
log the user back in when his session has expired.
The cookie's lifetime can be set using the setTokenLifetime method-
Field Summary
Fields inherited from class org.opencms.jsp.CmsJspActionElement
NOT_INITIALIZED -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetCookiePath(boolean resolveMacros) Gets the path to use for the authorization cookie, optionally resolving any macros used.booleanReturns true if the token has been set.voidLogs a system user into OpenCms.voidlogout()Logs a user out, i.e.voidlogout(boolean invalidateToken) Logs the user out and optionally invalidates their login token.voidsetCookiePath(String cookiePath) Sets the path to use for the login token cookie.voidsetTokenLifetime(long lifetime) Sets the number of milliseconds for which the tokens should be valid.Methods inherited from class org.opencms.jsp.CmsJspLoginBean
getFormLink, getLoginException, getUser, getUserName, isLoggedIn, isLoginSuccess, login, login, logLoginException, setVerificationCodeMethods inherited from class org.opencms.jsp.CmsJspActionElement
editable, editable, editable, editableManualClose, editableManualOpen, getContent, getContent, getMessages, getMessages, getMessages, getMessages, getNavigation, getNavigationUri, img, img, include, include, include, include, include, include, includeSilent, includeSilent, includeSilent, includeSilent, info, label, link, link, properties, properties, property, property, property, property, template, template, template, toAbsolute, userMethods inherited from class org.opencms.jsp.CmsJspBean
getCmsObject, getController, getJspContext, getMessage, getRequest, getRequestContext, getResponse, handleException, handleMissingFlexController, init, isNotInitialized, isSupressingExceptions, setContentType, setStatus, setSupressingExceptions
-
Constructor Details
-
CmsJspLoginPersistingBean
public CmsJspLoginPersistingBean()
-
-
Method Details
-
getCookiePath
Gets the path to use for the authorization cookie, optionally resolving any macros used.- Parameters:
resolveMacros- if true, macros should be resolved- Returns:
- the authorization cookie path
-
isTokenSet
Returns true if the token has been set.- Returns:
- true if the token has been set
-
login
Description copied from class:CmsJspLoginBeanLogs a system user into OpenCms.Note that if a login project name is provided, this project must exist, otherwise the login is regarded as a failure even if the user data was correct.
- Overrides:
loginin classCmsJspLoginBean- Parameters:
userName- the users namepassword- the passwordprojectName- the project to switch to after login (if null project is not switched)- See Also:
-
logout
Description copied from class:CmsJspLoginBeanLogs a user out, i.e. destroys the current users session, after that the current page will be redirected to itself one time to ensure that the users session is truly destroyed.- Overrides:
logoutin classCmsJspLoginBean- Throws:
IOException- if redirect after logout fails- See Also:
-
logout
Logs the user out and optionally invalidates their login token.- Parameters:
invalidateToken- true if the token should be invalidated- Throws:
IOException- if something goes wrong
-
setCookiePath
Sets the path to use for the login token cookie.You can use the macros %(SERVLET_NAME) and %(CONTEXT_NAME) in the cookie path; the default value is %(CONTEXT_NAME)%(SERVLET_NAME).
- Parameters:
cookiePath- the cookie path, possibly including macros
-
setTokenLifetime
Sets the number of milliseconds for which the tokens should be valid.- Parameters:
lifetime- the token life time
-