Class CmsLogin

java.lang.Object
org.opencms.jsp.CmsJspBean
org.opencms.jsp.CmsJspActionElement
org.opencms.jsp.CmsJspLoginBean
org.opencms.workplace.CmsLogin

public class CmsLogin extends org.opencms.jsp.CmsJspLoginBean
Handles the login of Users to the OpenCms workplace.

Since:
6.0.0
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final int
    Action constant: Default action, display the dialog.
    static final int
    Action constant: Login successful.
    static final int
    Action constant: Logout.
    static final String
    The parameter name for the "getoulist" action.
    static final String
    The parameter name for the "login" action.
    static final String
    The parameter name for the "logout" action.
    static final String
    The html id for the login form.
    static final String
    The parameter name for the organizational unit.
    static final String
    The parameter name for the search organizational unit.
    static final String
    The parameter name for the password.
    static final String
    The parameter name for the PC type.
    static final String
    The parameter name for the organizational unit.
    static final String
    The parameter name for the user name.
    static final String
    The parameter name for the workplace data.
    static final String
    PC type constant: private PC.
    static final String
    PC type constant: public PC.

    Fields inherited from class org.opencms.jsp.CmsJspActionElement

    NOT_INITIALIZED
  • Constructor Summary

    Constructors
    Constructor
    Description
    CmsLogin(javax.servlet.jsp.PageContext context, javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse res)
    Public constructor for login page.
  • Method Summary

    Modifier and Type
    Method
    Description
    protected void
    appendDefaultLoginScript(StringBuffer html, org.opencms.i18n.CmsMessageContainer message)
    Appends the JavaScript for the login screen to the given HTML buffer.
    protected void
    Appends the JavaScript that opens the Direct Edit window after a successful login to the given HTML buffer.
    protected void
    Appends the HTML form name/id code for the given id to the given html.
    protected void
    appendWorkplaceOpenerScript(StringBuffer html, String requestedResource, org.opencms.i18n.CmsMessageContainer message)
    Appends the JavaScript that opens the Workplace window after a successful login to the given HTML buffer.
    Returns the HTML code for selecting an organizational unit.
    Returns the HTML for the login dialog in it's current state.
    protected String
    Returns the HTML for the login form.
    protected static javax.servlet.http.Cookie
    getCookie(javax.servlet.http.HttpServletRequest request, String name)
    Returns the cookie with the given name, if not cookie is found a new one is created.
    void
    Gets the login info from the cookies.
    static String
    Gets the copyright information HTML.
    static String
    getDirectEditPath(org.opencms.file.CmsObject cms, org.opencms.db.CmsUserSettings userSettings)
    Returns the direct edit path from the user settings, or null if not set.
     
    Returns the available organizational units as JSON array string.
    static List<org.opencms.security.CmsOrganizationalUnit>
    getOrgUnitsForLoginDialog(org.opencms.file.CmsObject cms, String predefOu)
    Gets the list of OUs which should be selectable in the login dialog.
    protected List<org.opencms.security.CmsOrganizationalUnit>
    Returns all organizational units in the system.
    protected String
    Returns the predefined organizational unit fqn.
    static String
    getTitle(Locale locale)
    Gets the window title for a given locale.
    static org.opencms.workplace.CmsWorkplaceSettings
    initSiteAndProject(org.opencms.file.CmsObject cms)
    Initializes the site and project for a CMS context after login, and returns the workplace settings for the corresponding user.
    protected static void
    setCookie(javax.servlet.http.Cookie cookie, boolean delete, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
    Sets the cookie in the response.
    static void
    setCookieData(String pcType, String username, String oufqn, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
    Sets the cookie data.
    void
    setCookieData(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
    Sets the cookie data.
    static org.opencms.i18n.CmsMessageContainer
    Checks that the user name and password are not empty, and returns an error message if they are.

    Methods inherited from class org.opencms.jsp.CmsJspLoginBean

    getLoginException, getUser, getUserName, isLoggedIn, isLoginSuccess, login, login, login, logLoginException, logout, 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

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

  • Constructor Details

    • CmsLogin

      public CmsLogin(javax.servlet.jsp.PageContext context, javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse res)
      Public constructor for login page.

      Parameters:
      context - the JSP page context object
      req - the JSP request
      res - the JSP response
  • Method Details

    • getCopyrightHtml

      public static String getCopyrightHtml(Locale locale)
      Gets the copyright information HTML.

      Parameters:
      locale - the locale for which to get the copyright info
      Returns:
      the copyright info HTML
    • getDirectEditPath

      public static String getDirectEditPath(org.opencms.file.CmsObject cms, org.opencms.db.CmsUserSettings userSettings)
      Returns the direct edit path from the user settings, or null if not set.

      Parameters:
      cms - the CMS context to use
      userSettings - the user settings
      Returns:
      the direct edit path
    • getOrgUnitsForLoginDialog

      public static List<org.opencms.security.CmsOrganizationalUnit> getOrgUnitsForLoginDialog(org.opencms.file.CmsObject cms, String predefOu)
      Gets the list of OUs which should be selectable in the login dialog.

      Parameters:
      cms - the CMS context to use
      predefOu - the predefined OU
      Returns:
      the list of organizational units for the OU selector
    • getTitle

      public static String getTitle(Locale locale)
      Gets the window title for a given locale.

      Parameters:
      locale - the locale
      Returns:
      the window title
    • initSiteAndProject

      public static org.opencms.workplace.CmsWorkplaceSettings initSiteAndProject(org.opencms.file.CmsObject cms)
      Initializes the site and project for a CMS context after login, and returns the workplace settings for the corresponding user.

      Parameters:
      cms - the CMS context which should be initialized
      Returns:
      the workplace set
    • setCookieData

      public static void setCookieData(String pcType, String username, String oufqn, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
      Sets the cookie data.

      Parameters:
      pcType - the pctype value
      username - the username value
      oufqn - the oufqn value
      request - the current request
      response - the current response
    • validateUserAndPasswordNotEmpty

      public static org.opencms.i18n.CmsMessageContainer validateUserAndPasswordNotEmpty(String username, String password)
      Checks that the user name and password are not empty, and returns an error message if they are.

      Parameters:
      username - the user name
      password - the password
      Returns:
      the error message, or null if the user name and password are OK
    • getCookie

      protected static javax.servlet.http.Cookie getCookie(javax.servlet.http.HttpServletRequest request, String name)
      Returns the cookie with the given name, if not cookie is found a new one is created.

      Parameters:
      request - the current request
      name - the name of the cookie
      Returns:
      the cookie
    • setCookie

      protected static void setCookie(javax.servlet.http.Cookie cookie, boolean delete, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
      Sets the cookie in the response.

      Parameters:
      cookie - the cookie to set
      delete - flag to determine if the cookir should be deleted
      request - the current request
      response - the current response
    • buildOrgUnitSelector

      Returns the HTML code for selecting an organizational unit.

      Returns:
      the HTML code for selecting an organizational unit
    • displayDialog

      public String displayDialog() throws IOException, org.opencms.main.CmsException
      Returns the HTML for the login dialog in it's current state.

      Returns:
      the HTML for the login dialog
      Throws:
      IOException - in case a redirect fails
      org.opencms.main.CmsException - in case displaying the login dialog fails
    • getCookieData

      public void getCookieData()
      Gets the login info from the cookies.

    • getFormLink

      public String getFormLink()
      Overrides:
      getFormLink in class org.opencms.jsp.CmsJspLoginBean
      See Also:
      • CmsJspLoginBean.getFormLink()
    • getJsonOrgUnitList

      Returns the available organizational units as JSON array string.

      Returns:
      the available organizational units as JSON array string
    • setCookieData

      public void setCookieData(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
      Sets the cookie data.

      Parameters:
      request - the current request
      response - the current response
    • appendDefaultLoginScript

      protected void appendDefaultLoginScript(StringBuffer html, org.opencms.i18n.CmsMessageContainer message)
      Appends the JavaScript for the login screen to the given HTML buffer.

      Parameters:
      html - the HTML buffer to append the script to
      message - the message to display after an unsuccessful login
    • appendDirectEditOpenerScript

      Appends the JavaScript that opens the Direct Edit window after a successful login to the given HTML buffer.

      Parameters:
      html - the html buffer to append the script to
    • appendId

      protected void appendId(StringBuffer html, String id)
      Appends the HTML form name/id code for the given id to the given html.

      Parameters:
      html - the html where to append the id to
      id - the id to append
    • appendWorkplaceOpenerScript

      protected void appendWorkplaceOpenerScript(StringBuffer html, String requestedResource, org.opencms.i18n.CmsMessageContainer message)
      Appends the JavaScript that opens the Workplace window after a successful login to the given HTML buffer.

      Parameters:
      html - the html buffer to append the script to
      requestedResource - the requested resource to open in a new window
      message - the message to display if the originally requested resource is not available
    • displayLoginForm

      protected String displayLoginForm()
      Returns the HTML for the login form.

      Returns:
      the HTML for the login form
    • getOus

      protected List<org.opencms.security.CmsOrganizationalUnit> getOus()
      Returns all organizational units in the system.

      Returns:
      a list of CmsOrganizationalUnit objects
    • getPreDefOuFqn

      protected String getPreDefOuFqn()
      Returns the predefined organizational unit fqn.

      This is normally selected by url, and set by the CmsWorkplaceLoginHandler.

      Returns:
      the predefined organizational unit fqn