com.plumtree.uiinfrastructure.login
Class LoginHelper

java.lang.Object
  extended by com.plumtree.uiinfrastructure.login.LoginHelper

public final class LoginHelper
extends java.lang.Object

This Singleton class controls session login. To implement your own session login code, simply implement an instance of ILoginHelper and initialize this class with your helper using the StaticInit method. All logins should be done through this class, rather than directly calling the custom login code in an ILoginHelper.

Author:
DonH

Field Summary
static java.lang.String GUEST_USER_NAME
          The name of the guest user that will be passed in to the OnBeforeLogin method of the LoginActions PEI.
static LoginHelper INSTANCE
          Use this class static to access the one and only instance of LoginHelper.
static java.lang.String LOGIN_TOKEN_COOKIE_DEFUNCT_VALUE
           
static java.lang.String LOGIN_TOKEN_COOKIE_NAME
          constants for login token cookies.
static java.lang.String PARAM_DOLOGOUT
          This string is used by SSO login to determine if the user has clicked the logout link.
static java.lang.String PARAM_DONT_LOGIN_JUST_REDIRECT
          Parameter indicates to loginControl that it should not attempt to login, it should just redirect as though it has logged in.
static java.lang.String PARAM_LOGIN
          This string is used by SSO login to determine if the user has clicked the login link.
static java.lang.String PARAM_SSOLOGOUT
          Parameter that indicates that the login control should show the SSO logout page rather than the standard login page.
static java.lang.String REPLICATION_COOKIE_NAME
          constant for replication cookie used in high availability
 
Method Summary
 LoginResult AttemptBasicAuthLogin(java.lang.String sEncodedCredentials, ISessionManager subSession, ISessionManager persistentSubSession, IApplication application, java.lang.String strRequestURL, IXPRequest request, IWebData webData)
          Attempts to create and connect a new user session.
 LoginResult AttemptGuestLogin(int nUserID, java.lang.String strUserName, java.lang.Object token, ISessionManager subSession, ISessionManager persistentSubSession, IApplication application, java.lang.String strRequestURL, IXPRequest request, IWebData webData)
          Attempts to create and connect a new guest user session.
 LoginResult AttemptGuestLogin(java.lang.Object token, ISessionManager subSession, ISessionManager persistentSubSession, IApplication application, java.lang.String strRequestURL, IXPRequest request, IWebData webData)
          Attempts to create and connect a new user session.
 LoginResult AttemptLogin(java.lang.Object userSession, AActivitySpace asOwner, IXPRequest request, IWebData webData)
          Handles login tasks for the new session.
 LoginResult AttemptLogin(java.lang.Object userSession, ISessionManager subSession, ISessionManager persistentSubSession, IApplication application, IXPRequest request, IWebData webData)
          Handles login tasks for the new session.
 LoginResult AttemptLogin(java.lang.String sLoginToken, AActivitySpace asOwner, IXPRequest request, IWebData webData)
          Attempts to create and connect a new user session.
 LoginResult AttemptLogin(java.lang.String sLoginToken, ISessionManager subSession, ISessionManager persistentSubSession, IApplication application, java.lang.String sRequestURL, IXPRequest request, IWebData webData)
          Attempts to create and connect a new user session.
 LoginResult AttemptLogin(java.lang.String strUserName, java.lang.String strPassword, java.lang.Object token, boolean bUseNumericConnect, AActivitySpace asOwner, IXPRequest request, IWebData webData)
          Attempts to create and connect a new user session.
 LoginResult AttemptLogin(java.lang.String strUserName, java.lang.String strPassword, java.lang.Object token, boolean bUseNumericConnect, ISessionManager subSession, ISessionManager persistentSubSession, IApplication application, java.lang.String strRequestURL, IXPRequest request, IWebData webData)
          Attempts to create and connect a new user session.
 void ClearAutologinToken(java.lang.String strCurrentRequestURL, IWebData webData)
          Call this method to clear an autologin token cookie from the users session.
 FailedLoginResult DoTaskOnFailedLogin(java.lang.String _strUserName, XPException error, IXPRequest request, IWebData webData, IApplication application, ISessionManager sessionManager, ISessionManager persistentSessionManager)
          This function will load all of the implemented LoginActions PEIs and then process through them and call the OnFailedLogin function for each one.
 Redirect DoTasksBeforeLogout(AActivitySpace asSpace, IXPRequest request, IWebData webData)
          This function will process all of the OnLogout ILoginActions functions and send the necessary Redirect back to the caller.
 Redirect DoTasksBeforeLogout(java.lang.Object userSession, IXPRequest request, IWebData webData, IApplication application, ISessionManager sessionManager, ISessionManager persistentSessionManager)
          This function will process all of the OnLogout ILoginActions functions and send the necessary Redirect back to the caller.
 java.lang.String GetAutologinToken(IXPRequest request)
          Call this method to obtain an autologin token from the request.
 ILink GetDefaultPageRedirect(ILink suppliedLink, java.lang.Object userSession, AActivitySpace asOwner)
          Call this method to obtain a redirect to the default space.
 boolean GetIsGuestUser(java.lang.Object userSession)
          This method returns whether or not the user is a guest user.
 HTMLElementCollection GetStyleSheetLinks(java.lang.Object userSession, AActivitySpace asOwner)
          Returns an HTMLElementCollection of style sheet links.
 java.lang.String GetUserSessionID(java.lang.Object userSession)
          This method gets the user ID from the supplied user session object.
 java.lang.String GetUserSessionName(java.lang.Object userSession)
          This method gets the user Name from the supplied user session object.
 java.lang.Object HandleCOMProcessRecycled(java.lang.Object userSession)
          This method is used to handle COM Process Recycling in .NET.
 boolean HasValidBasicAuthLogin(java.lang.String sEncodedCredentials)
          This method checks whether or not the supplied credentials are valid basic auth credentials, without actually logging the user in completely (a new PTSession is created).
 void SetAutologinToken(IWebData oWebData, IXPRequest xpRequest, java.lang.Object oUserSession, int nExpires, boolean bIsPersistentCookie)
          Call this method to set an autologin token for the user.
static void StaticInit(ILoginHelper loginHelper)
          Static initialization method.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LOGIN_TOKEN_COOKIE_NAME

public static final java.lang.String LOGIN_TOKEN_COOKIE_NAME
constants for login token cookies.

See Also:
Constant Field Values

LOGIN_TOKEN_COOKIE_DEFUNCT_VALUE

public static final java.lang.String LOGIN_TOKEN_COOKIE_DEFUNCT_VALUE
See Also:
Constant Field Values

REPLICATION_COOKIE_NAME

public static final java.lang.String REPLICATION_COOKIE_NAME
constant for replication cookie used in high availability

See Also:
Constant Field Values

PARAM_LOGIN

public static final java.lang.String PARAM_LOGIN
This string is used by SSO login to determine if the user has clicked the login link.

See Also:
Constant Field Values

PARAM_DOLOGOUT

public static final java.lang.String PARAM_DOLOGOUT
This string is used by SSO login to determine if the user has clicked the logout link.

See Also:
Constant Field Values

PARAM_SSOLOGOUT

public static final java.lang.String PARAM_SSOLOGOUT
Parameter that indicates that the login control should show the SSO logout page rather than the standard login page.

See Also:
Constant Field Values

PARAM_DONT_LOGIN_JUST_REDIRECT

public static final java.lang.String PARAM_DONT_LOGIN_JUST_REDIRECT
Parameter indicates to loginControl that it should not attempt to login, it should just redirect as though it has logged in. Used by SSO to have the login control handle redirecting to the correct place.

See Also:
Constant Field Values

GUEST_USER_NAME

public static final java.lang.String GUEST_USER_NAME
The name of the guest user that will be passed in to the OnBeforeLogin method of the LoginActions PEI. This could theoretically be different from the name of the guest user in the portal.

See Also:
Constant Field Values

INSTANCE

public static final LoginHelper INSTANCE
Use this class static to access the one and only instance of LoginHelper.

Method Detail

StaticInit

public static final void StaticInit(ILoginHelper loginHelper)
Static initialization method. Use this method to add custom user session object handling code. This method does not need to be called.

Parameters:
ILoginHelper - custom login code

AttemptLogin

public LoginResult AttemptLogin(java.lang.String strUserName,
                                java.lang.String strPassword,
                                java.lang.Object token,
                                boolean bUseNumericConnect,
                                AActivitySpace asOwner,
                                IXPRequest request,
                                IWebData webData)
Attempts to create and connect a new user session. Calls Login PEIs.

Returns:
LoginResult the result of this login attempt.

AttemptGuestLogin

public LoginResult AttemptGuestLogin(java.lang.Object token,
                                     ISessionManager subSession,
                                     ISessionManager persistentSubSession,
                                     IApplication application,
                                     java.lang.String strRequestURL,
                                     IXPRequest request,
                                     IWebData webData)
Attempts to create and connect a new user session. Calls Login PEIs. Note that this signature of AttemptGuestLogin will log in as the default guest user.

Returns:
LoginResult the result of this login attempt.

AttemptGuestLogin

public LoginResult AttemptGuestLogin(int nUserID,
                                     java.lang.String strUserName,
                                     java.lang.Object token,
                                     ISessionManager subSession,
                                     ISessionManager persistentSubSession,
                                     IApplication application,
                                     java.lang.String strRequestURL,
                                     IXPRequest request,
                                     IWebData webData)
Attempts to create and connect a new guest user session. The session connects as the given guest user ID. The given username is used only for Login PEIs. Calls Login PEIs.

Returns:
LoginResult the result of this login attempt.

AttemptLogin

public LoginResult AttemptLogin(java.lang.String strUserName,
                                java.lang.String strPassword,
                                java.lang.Object token,
                                boolean bUseNumericConnect,
                                ISessionManager subSession,
                                ISessionManager persistentSubSession,
                                IApplication application,
                                java.lang.String strRequestURL,
                                IXPRequest request,
                                IWebData webData)
Attempts to create and connect a new user session. Calls Login PEIs.

Returns:
LoginResult the result of this login attempt.

AttemptLogin

public LoginResult AttemptLogin(java.lang.String sLoginToken,
                                AActivitySpace asOwner,
                                IXPRequest request,
                                IWebData webData)
Attempts to create and connect a new user session. Calls Login PEIs.

Returns:
LoginResult the result of this login attempt.

AttemptLogin

public LoginResult AttemptLogin(java.lang.String sLoginToken,
                                ISessionManager subSession,
                                ISessionManager persistentSubSession,
                                IApplication application,
                                java.lang.String sRequestURL,
                                IXPRequest request,
                                IWebData webData)
Attempts to create and connect a new user session. Calls Login PEIs.

Returns:
LoginResult the result of this login attempt.

AttemptLogin

public LoginResult AttemptLogin(java.lang.Object userSession,
                                AActivitySpace asOwner,
                                IXPRequest request,
                                IWebData webData)
Handles login tasks for the new session. Calls Login PEIs, but does not call AttemptLogin. This is used while editing default profiles and impersonating users. This should not be used otherwise.

Parameters:
Object - userSession - a pre-connected user session.
Returns:
LoginResult the result of this login attempt.

AttemptLogin

public LoginResult AttemptLogin(java.lang.Object userSession,
                                ISessionManager subSession,
                                ISessionManager persistentSubSession,
                                IApplication application,
                                IXPRequest request,
                                IWebData webData)
Handles login tasks for the new session. Calls Login PEIs, but does not call AttemptLogin. This is used while editing default profiles and impersonating users. This should not be used otherwise.

Parameters:
Object - userSession - a pre-connected user session.
Returns:
LoginResult the result of this login attempt.

HasValidBasicAuthLogin

public boolean HasValidBasicAuthLogin(java.lang.String sEncodedCredentials)
This method checks whether or not the supplied credentials are valid basic auth credentials, without actually logging the user in completely (a new PTSession is created).

Parameters:
sEncodedCredentials - the encoded basic auth credentials to validate
Returns:
whether or not the supplied credentials are valid basic auth credentials.

AttemptBasicAuthLogin

public LoginResult AttemptBasicAuthLogin(java.lang.String sEncodedCredentials,
                                         ISessionManager subSession,
                                         ISessionManager persistentSubSession,
                                         IApplication application,
                                         java.lang.String strRequestURL,
                                         IXPRequest request,
                                         IWebData webData)
Attempts to create and connect a new user session. This method is used for Basic Auth logins. Unfortunately, in Basic Auth the user name and password are encoded in the character encoding of the client machine, and the server does not know what that is. Therefore we have to guess the appropriate encoding. The user credentials passed to this method need to be unencoded as win-1252, shift-jis, Big5, etc... before they can be used. The credentials are basic auth credentials; user name and password are separated by a colon.

Returns:
LoginResult the result of this login attempt.

GetUserSessionID

public java.lang.String GetUserSessionID(java.lang.Object userSession)
This method gets the user ID from the supplied user session object.

Parameters:
Object - the user session
Returns:
String the user ID (return "" instead of null if necessary)
See Also:
ILoginHelper.GetUserSessionID(Object)

GetUserSessionName

public java.lang.String GetUserSessionName(java.lang.Object userSession)
This method gets the user Name from the supplied user session object.

Parameters:
Object - the user session
Returns:
String the user name (return "" instead of null if necessary)
See Also:
ILoginHelper.GetUserSessionName(Object)

GetIsGuestUser

public boolean GetIsGuestUser(java.lang.Object userSession)
This method returns whether or not the user is a guest user.

Parameters:
Object - the user session
Returns:
boolean true implies the user is a guest user.
See Also:
ILoginHelper.GetIsGuestUser(Object)

SetAutologinToken

public void SetAutologinToken(IWebData oWebData,
                              IXPRequest xpRequest,
                              java.lang.Object oUserSession,
                              int nExpires,
                              boolean bIsPersistentCookie)
Call this method to set an autologin token for the user.

Parameters:
oWebData -
xpRequest -
oUserSession -
nExpires - cookie and token expiration time in seconds. -1 means use default value.
bIsPersistentCookie - false means don't set an expires time (expire at end of session).

GetAutologinToken

public java.lang.String GetAutologinToken(IXPRequest request)
Call this method to obtain an autologin token from the request.

Parameters:
request - IXPRequest
Returns:
String token that may be used to log in. Null if no token is available.

ClearAutologinToken

public void ClearAutologinToken(java.lang.String strCurrentRequestURL,
                                IWebData webData)
Call this method to clear an autologin token cookie from the users session.

Parameters:
String - Current Request URL.
IWebData - the page data object for the current request.

GetDefaultPageRedirect

public ILink GetDefaultPageRedirect(ILink suppliedLink,
                                    java.lang.Object userSession,
                                    AActivitySpace asOwner)
Call this method to obtain a redirect to the default space.

Parameters:
ILink - user supplied link that will get filled in with the proper parameters. (Redirect or ASURL object)
Object - userSession
AActivitySpace -
Returns:
ILink to the default page for this user. (null if error)

DoTasksBeforeLogout

public Redirect DoTasksBeforeLogout(AActivitySpace asSpace,
                                    IXPRequest request,
                                    IWebData webData)
This function will process all of the OnLogout ILoginActions functions and send the necessary Redirect back to the caller.

Parameters:
AActivitySpace -
Returns:
Redirect - Redirect to where the user should be sent after the logout.

DoTasksBeforeLogout

public Redirect DoTasksBeforeLogout(java.lang.Object userSession,
                                    IXPRequest request,
                                    IWebData webData,
                                    IApplication application,
                                    ISessionManager sessionManager,
                                    ISessionManager persistentSessionManager)
This function will process all of the OnLogout ILoginActions functions and send the necessary Redirect back to the caller.

Parameters:
userSession -
application -
sessionManager -
Returns:
Redirect - Redirect to where the user should be sent after the logout.

DoTaskOnFailedLogin

public FailedLoginResult DoTaskOnFailedLogin(java.lang.String _strUserName,
                                             XPException error,
                                             IXPRequest request,
                                             IWebData webData,
                                             IApplication application,
                                             ISessionManager sessionManager,
                                             ISessionManager persistentSessionManager)
This function will load all of the implemented LoginActions PEIs and then process through them and call the OnFailedLogin function for each one. In general, this method should only be called by the LoginHelper itself. The only reason to call this method directly is if you are failing the login before calling the AttemptLogin method (i.e. because of a hack attempt).

Parameters:
_strUserName - - user that has failed the login process.
error - - the exception that caused login to fail, may be null
application -
sessionManager -
Returns:
FailedLoginResult - Error message and/or Redirect from the PEI.

GetStyleSheetLinks

public HTMLElementCollection GetStyleSheetLinks(java.lang.Object userSession,
                                                AActivitySpace asOwner)
Returns an HTMLElementCollection of style sheet links. A style sheet is named "stylesheetname-language", for instance "mainstyle12-en".

Parameters:
userSession -
AActivitySpace -

HandleCOMProcessRecycled

public java.lang.Object HandleCOMProcessRecycled(java.lang.Object userSession)
This method is used to handle COM Process Recycling in .NET. This should not be used by anyone outside of the Interpreter.

Parameters:
userSession -
Returns:



Copyright © 2002,2003,2004,2005 Plumtree Software, Inc., All Rights Reserved.