Class 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
  • Constructor Details

  • Method Details

    • getCookiePath

      public 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(String userName, String password, 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 class CmsJspLoginBean
      Parameters:
      userName - the users name
      password - the password
      projectName - the project to switch to after login (if null project is not switched)
      See Also:
    • logout

      public void logout() throws 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 class CmsJspLoginBean
      Throws:
      IOException - if redirect after logout fails
      See Also:
    • logout

      public void logout(boolean invalidateToken) throws IOException
      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

      public void setCookiePath(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