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
-
public class CmsJspLoginPersistingBean extends CmsJspLoginBean
Login bean which sets a cookie that can be used byCmsPersistentLoginAuthorizationHandler
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 Constructor Description CmsJspLoginPersistingBean()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.String
getCookiePath(boolean resolveMacros)
Gets the path to use for the authorization cookie, optionally resolving any macros used.boolean
isTokenSet()
Returns true if the token has been set.void
login(java.lang.String userName, java.lang.String password, java.lang.String projectName)
Logs a system user into OpenCms.void
logout()
Logs a user out, i.e.void
logout(boolean invalidateToken)
Logs the user out and optionally invalidates their login token.void
setCookiePath(java.lang.String cookiePath)
Sets the path to use for the login token cookie.void
setTokenLifetime(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, setVerificationCode
-
Methods 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, user
-
Methods inherited from class org.opencms.jsp.CmsJspBean
getCmsObject, getController, getJspContext, getMessage, getRequest, getRequestContext, getResponse, handleException, handleMissingFlexController, init, isNotInitialized, isSupressingExceptions, setContentType, setStatus, setSupressingExceptions
-
-
-
-
Constructor Detail
-
CmsJspLoginPersistingBean
public CmsJspLoginPersistingBean()
-
-
Method Detail
-
getCookiePath
public java.lang.String getCookiePath(boolean resolveMacros)
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
public boolean isTokenSet()
Returns true if the token has been set.- Returns:
- true if the token has been set
-
login
public void login(java.lang.String userName, java.lang.String password, java.lang.String projectName)
Description copied from class:CmsJspLoginBean
Logs 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:
login
in classCmsJspLoginBean
- Parameters:
userName
- the users namepassword
- the passwordprojectName
- the project to switch to after login (if null project is not switched)- See Also:
CmsJspLoginBean.login(java.lang.String, java.lang.String, java.lang.String)
-
logout
public void logout() throws java.io.IOException
Description copied from class:CmsJspLoginBean
Logs 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:
logout
in classCmsJspLoginBean
- Throws:
java.io.IOException
- if redirect after logout fails- See Also:
CmsJspLoginBean.logout()
-
logout
public void logout(boolean invalidateToken) throws java.io.IOException
Logs the user out and optionally invalidates their login token.- Parameters:
invalidateToken
- true if the token should be invalidated- Throws:
java.io.IOException
- if something goes wrong
-
setCookiePath
public void setCookiePath(java.lang.String cookiePath)
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
public void setTokenLifetime(long lifetime)
Sets the number of milliseconds for which the tokens should be valid.- Parameters:
lifetime
- the token life time
-
-