org.opencms.workplace
Class CmsLogin

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

public class CmsLogin
extends CmsJspLoginBean

Handles the login of Users to the OpenCms workplace.

Since:
6.0.0
Version:
$Revision: 1.44 $
Author:
Alexander Kandzior

Field Summary
static int ACTION_DISPLAY
          Action constant: Default action, display the dialog.
static int ACTION_LOGIN
          Action constant: Login successful.
static int ACTION_LOGOUT
          Action constant: Logout.
static java.lang.String PARAM_ACTION_LOGIN
          The parameter name for the "login" action.
static java.lang.String PARAM_ACTION_LOGOUT
          The parameter name for the "logout" action.
static java.lang.String PARAM_FORM
          The html id for the login form.
static java.lang.String PARAM_OUFQN
          The parameter name for the organizational unit.
static java.lang.String PARAM_PASSWORD
          The parameter name for the password.
static java.lang.String PARAM_PREDEF_OUFQN
          The parameter name for the organizational unit.
static java.lang.String PARAM_USERNAME
          The parameter name for the user name.
 
Fields inherited from class org.opencms.jsp.CmsJspActionElement
NOT_INITIALIZED
 
Constructor Summary
CmsLogin(javax.servlet.jsp.PageContext context, javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse res)
          Public constructor for login page.
 
Method Summary
protected  void appendDefaultLoginScript(java.lang.StringBuffer html, CmsMessageContainer message)
          Appends the JavaScript for the login screen to the given HTML buffer.
protected  void appendId(java.lang.StringBuffer html, java.lang.String id)
          Appends the HTML form name/id code for the given id to the given html.
protected  void appendWorkplaceOpenerScript(java.lang.StringBuffer html, java.lang.String requestedResource, CmsMessageContainer message)
          Appends the JavaScript that opens the Workplace window after a successful login to the given HTML buffer.
 java.lang.String buildOrgUnitSelector()
          Returns html code for selecting an organizational unit.
 java.lang.String displayDialog()
          Returns the HTML for the login dialog in it's current state.
protected  java.lang.String displayLoginForm()
          Returns the HTML for the login form.
protected  javax.servlet.http.Cookie getCookie(java.lang.String name)
          Returns the cookie with the given name, if not cookie is found a new one is created.
 void getCookieData()
          Gets the login info from the cookies.
 java.lang.String getFormLink()
          Returns the link to the form that contains the login element.
protected  java.util.List getOus()
          Returns all organizational units in the system.
protected  java.lang.String getPreDefOuFqn()
          Returns the predefined organizational unit fqn.
protected  void setCookie(javax.servlet.http.Cookie cookie)
          Sets the cookie in the response.
 void setCookieData()
          Sets the login cookies.
 
Methods inherited from class org.opencms.jsp.CmsJspLoginBean
getLoginException, getUser, getUserName, isLoggedIn, isLoginSuccess, login, login, login, logout
 
Methods inherited from class org.opencms.jsp.CmsJspActionElement
editable, editable, editable, editableManualClose, editableManualOpen, getContent, getContent, getMessages, getMessages, getMessages, getMessages, getNavigation, img, img, include, include, include, include, include, includeSilent, includeSilent, includeSilent, includeSilent, info, label, 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, 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 Detail

ACTION_DISPLAY

public static final int ACTION_DISPLAY
Action constant: Default action, display the dialog.

See Also:
Constant Field Values

ACTION_LOGIN

public static final int ACTION_LOGIN
Action constant: Login successful.

See Also:
Constant Field Values

ACTION_LOGOUT

public static final int ACTION_LOGOUT
Action constant: Logout.

See Also:
Constant Field Values

PARAM_ACTION_LOGIN

public static final java.lang.String PARAM_ACTION_LOGIN
The parameter name for the "login" action.

See Also:
Constant Field Values

PARAM_ACTION_LOGOUT

public static final java.lang.String PARAM_ACTION_LOGOUT
The parameter name for the "logout" action.

See Also:
Constant Field Values

PARAM_FORM

public static final java.lang.String PARAM_FORM
The html id for the login form.

See Also:
Constant Field Values

PARAM_OUFQN

public static final java.lang.String PARAM_OUFQN
The parameter name for the organizational unit.

See Also:
Constant Field Values

PARAM_PASSWORD

public static final java.lang.String PARAM_PASSWORD
The parameter name for the password.

See Also:
Constant Field Values

PARAM_PREDEF_OUFQN

public static final java.lang.String PARAM_PREDEF_OUFQN
The parameter name for the organizational unit.

See Also:
Constant Field Values

PARAM_USERNAME

public static final java.lang.String PARAM_USERNAME
The parameter name for the user name.

See Also:
Constant Field Values
Constructor Detail

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 Detail

buildOrgUnitSelector

public java.lang.String buildOrgUnitSelector()
Returns html code for selecting an organizational unit.

Returns:
html code

displayDialog

public java.lang.String displayDialog()
                               throws java.io.IOException
Returns the HTML for the login dialog in it's current state.

Returns:
the HTML for the login dialog
Throws:
java.io.IOException - in case a redirect fails

getCookieData

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


getFormLink

public java.lang.String getFormLink()
Description copied from class: CmsJspLoginBean
Returns the link to the form that contains the login element.

Overrides:
getFormLink in class CmsJspLoginBean
Returns:
the link to the form that contains the login element
See Also:
CmsJspLoginBean.getFormLink()

setCookieData

public void setCookieData()
Sets the login cookies.


appendDefaultLoginScript

protected void appendDefaultLoginScript(java.lang.StringBuffer html,
                                        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

appendId

protected void appendId(java.lang.StringBuffer html,
                        java.lang.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(java.lang.StringBuffer html,
                                           java.lang.String requestedResource,
                                           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 java.lang.String displayLoginForm()
Returns the HTML for the login form.

Returns:
the HTML for the login form

getCookie

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

Parameters:
name - the name of the cookie
Returns:
the cookie

getOus

protected java.util.List getOus()
Returns all organizational units in the system.

Returns:
a list of CmsOrganizationalUnit objects

getPreDefOuFqn

protected java.lang.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

setCookie

protected void setCookie(javax.servlet.http.Cookie cookie)
Sets the cookie in the response.

Parameters:
cookie - the cookie to set