com.plumtree.portaluiinfrastructure.login
Class PTLoginHelper

java.lang.Object
  extended by com.plumtree.portaluiinfrastructure.login.PTLoginHelper
All Implemented Interfaces:
ILoginHelper

public class PTLoginHelper
extends java.lang.Object
implements ILoginHelper

This class handles IPTSession login code.


Field Summary
static long ALLOW_USER_CREATION_LINK_CACHE_LIFE_MS
          This is the number of milliseconds for which the Boolean indicating whether or not the allow user creation link is cached on the application.
 
Constructor Summary
PTLoginHelper()
           
 
Method Summary
static boolean AllowAuthDropdown()
          Whether or not to allow the authentication source dropdown.
 java.lang.Object AttemptBasicAuthLogin(java.lang.String sEncodedCredentials)
          Attempts to create and connect a new user session.
protected  IPTSession AttemptBasicAuthLogin(java.lang.String sEncodedCredentials, java.lang.String sEncoding)
          This helper method attempts to login using the credentials and decodes them with the specified encoding.
 java.lang.Object AttemptGuestLogin(int nUserID, java.lang.Object token, ISessionManager subSession, IApplication application, java.lang.String sRequestURL)
          Multiple-guest-user support.
 java.lang.Object AttemptGuestLogin(java.lang.Object token, ISessionManager subSession, IApplication application, java.lang.String sRequestURL)
          Attempts to create and connect a new default guest user session.
 java.lang.Object AttemptLogin(java.lang.String sLoginToken, ISessionManager subSession, IApplication application, java.lang.String sRequestURL, IXPRequest request)
          Attempts to create and connect a new user session.
 java.lang.Object AttemptLogin(java.lang.String sUserName, java.lang.String sPassword, java.lang.Object token, boolean bUseNumericConnect, ISessionManager subSession, IApplication application, java.lang.String sRequestURL)
          Attempts to create and connect a new user session.
static boolean GetAllowUserCreation(AActivitySpace space, IApplication application)
          This method returns whether or not to allow user creation and handles caching and refreshing of this value.
 ILink GetDefaultPageRedirect(ILink suppliedLink, java.lang.Object userSession, AActivitySpace asOwner)
          Call this method to obtain a redirect to the default space.
static java.lang.String GetDefaultPrefix()
          The default prefix
 java.lang.String GetDetailedFailureMessage(java.lang.Exception exception, ISessionManager subSession, IApplication application)
          This method gets an error message suitable for display to the user from the supplied exception (i.e.
static int GetDropdownMode()
          Return the dropdown mode specified in the portal configuration.
 boolean GetIsGuestUser(java.lang.Object userSession)
          This method returns whether or not the user is a guest user.
static IPTSession GetPTSession(AActivitySpace aSpace)
          Method GetPTSession.
 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 HandleCOMPlusProcessRecycled(java.lang.Object userSession)
          Checks if the current process has been recycled.
static void SetAllowUserCreation(AActivitySpace space, IApplication application, boolean b)
          This method sets whether or not to allow user creation.
 void SetAutologinToken(IWebData oWebData, java.lang.Object oUserSession, int nExpires, boolean bIsPersistentCookie, boolean bIsSecure)
          Call this method to set an autologin token for the user.
static boolean ShowAuthDropdown()
          Whether or not to show the authentication source dropdown.
static boolean ShowRememberMyPassword()
          Whether or not to show the remember my password checkbox.
static void StaticInit(PTConfigVarPack vpConfig)
          Initialize various variables from the xml file.
protected  boolean VerifyNoAlternateLogins(java.lang.String sEncodedCredentials, int nSuccessfulEncoding)
          This helper method verifies that after a successful login, no other character encodings could be used to get a successful login.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ALLOW_USER_CREATION_LINK_CACHE_LIFE_MS

public static final long ALLOW_USER_CREATION_LINK_CACHE_LIFE_MS
This is the number of milliseconds for which the Boolean indicating whether or not the allow user creation link is cached on the application. After this many milliseconds, the server will be again querried, and a new value will be generated.

See Also:
Constant Field Values
Constructor Detail

PTLoginHelper

public PTLoginHelper()
Method Detail

AttemptLogin

public java.lang.Object AttemptLogin(java.lang.String sUserName,
                                     java.lang.String sPassword,
                                     java.lang.Object token,
                                     boolean bUseNumericConnect,
                                     ISessionManager subSession,
                                     IApplication application,
                                     java.lang.String sRequestURL)
Description copied from interface: ILoginHelper
Attempts to create and connect a new user session.

Specified by:
AttemptLogin in interface ILoginHelper
Returns:
a valid userSession
See Also:
com.plumtree.uiinfrastructure.login.ILoginHelper#AttemptLogin(String, String, Object, ISessionManager, IApplication)

AttemptGuestLogin

public java.lang.Object AttemptGuestLogin(java.lang.Object token,
                                          ISessionManager subSession,
                                          IApplication application,
                                          java.lang.String sRequestURL)
Description copied from interface: ILoginHelper
Attempts to create and connect a new default guest user session.

Specified by:
AttemptGuestLogin in interface ILoginHelper
Returns:
a valid guest userSession
See Also:
com.plumtree.uiinfrastructure.login.ILoginHelper#AttemptGuestLogin(Object, ISessionManager, IApplication)

AttemptGuestLogin

public java.lang.Object AttemptGuestLogin(int nUserID,
                                          java.lang.Object token,
                                          ISessionManager subSession,
                                          IApplication application,
                                          java.lang.String sRequestURL)
Description copied from interface: ILoginHelper
Multiple-guest-user support. Attempts to create a new user session and connect as the given guest user.

Specified by:
AttemptGuestLogin in interface ILoginHelper
Returns:
a valid guest userSession
See Also:
com.plumtree.uiinfrastructure.login.ILoginHelper#AttemptGuestLogin(int, Object, ISessionManager, IApplication)

AttemptLogin

public java.lang.Object AttemptLogin(java.lang.String sLoginToken,
                                     ISessionManager subSession,
                                     IApplication application,
                                     java.lang.String sRequestURL,
                                     IXPRequest request)
Description copied from interface: ILoginHelper
Attempts to create and connect a new user session. Throws an exception if login fails.

Specified by:
AttemptLogin in interface ILoginHelper
Returns:
a valid user session
See Also:
com.plumtree.uiinfrastructure.login.ILoginHelper#AttemptLogin(String, ISessionManager, IApplication)

GetUserSessionID

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

Specified by:
GetUserSessionID in interface ILoginHelper
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)
Description copied from interface: ILoginHelper
This method gets the user Name from the supplied user session object.

Specified by:
GetUserSessionName in interface ILoginHelper
Returns:
String the user Name (return "" instead of null if necessary)
See Also:
ILoginHelper.GetUserSessionName(Object)

GetIsGuestUser

public boolean GetIsGuestUser(java.lang.Object userSession)
Description copied from interface: ILoginHelper
This method returns whether or not the user is a guest user.

Specified by:
GetIsGuestUser in interface ILoginHelper
Returns:
boolean true implies the user is a guest user.
See Also:
ILoginHelper.GetIsGuestUser(Object)

GetDetailedFailureMessage

public java.lang.String GetDetailedFailureMessage(java.lang.Exception exception,
                                                  ISessionManager subSession,
                                                  IApplication application)
Description copied from interface: ILoginHelper
This method gets an error message suitable for display to the user from the supplied exception (i.e. localized and without any details that a hacker could exploit, such as whether or not that particular user name is valid).

Specified by:
GetDetailedFailureMessage in interface ILoginHelper
Returns:
String the error message for the user (return "" instead of null if necessary)
See Also:
ILoginHelper.GetDetailedFailureMessage(Exception, ISessionManager, IApplication)

AttemptBasicAuthLogin

public java.lang.Object AttemptBasicAuthLogin(java.lang.String sEncodedCredentials)
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.

Specified by:
AttemptBasicAuthLogin in interface ILoginHelper
Returns:
a valid userSession

AttemptBasicAuthLogin

protected IPTSession AttemptBasicAuthLogin(java.lang.String sEncodedCredentials,
                                           java.lang.String sEncoding)
This helper method attempts to login using the credentials and decodes them with the specified encoding.

Parameters:
sEncodedCredentials -
sEncoding -
Returns:
user session

VerifyNoAlternateLogins

protected boolean VerifyNoAlternateLogins(java.lang.String sEncodedCredentials,
                                          int nSuccessfulEncoding)
This helper method verifies that after a successful login, no other character encodings could be used to get a successful login.

Parameters:
sEncodedCredentials -
nSuccessfulEncoding - the index into HTTPBasicAuthenticator.BASIC_AUTH_ENCODINGS_ORDERED of the successful encoding.
Returns:
false implies there were multiple logins - possible security hole if a user could login as another user.

GetDefaultPageRedirect

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

Specified by:
GetDefaultPageRedirect in interface ILoginHelper
Returns:
ILink to the default page for this user.
See Also:
com.plumtree.uiinfrastructure.login.ILoginHelper#GetDefaultPageRedirect()

SetAllowUserCreation

public static void SetAllowUserCreation(AActivitySpace space,
                                        IApplication application,
                                        boolean b)
This method sets whether or not to allow user creation.

Parameters:
space - the current Activity Space
application - the application
boolean - whether or not to allow user creation.

GetAllowUserCreation

public static boolean GetAllowUserCreation(AActivitySpace space,
                                           IApplication application)
This method returns whether or not to allow user creation and handles caching and refreshing of this value.

Parameters:
space - The Activity Space
application - The Application
Returns:
boolean true implies allow user creation.

ShowAuthDropdown

public static boolean ShowAuthDropdown()
Whether or not to show the authentication source dropdown.


AllowAuthDropdown

public static boolean AllowAuthDropdown()
Whether or not to allow the authentication source dropdown.


ShowRememberMyPassword

public static boolean ShowRememberMyPassword()
Whether or not to show the remember my password checkbox.


GetDefaultPrefix

public static java.lang.String GetDefaultPrefix()
The default prefix


StaticInit

public static void StaticInit(PTConfigVarPack vpConfig)
Initialize various variables from the xml file.


GetPTSession

public static IPTSession GetPTSession(AActivitySpace aSpace)
Method GetPTSession. Gets IPTSession from AActivitySpace cleanly.

Parameters:
as -
Returns:
IPTSession

SetAutologinToken

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

Specified by:
SetAutologinToken in interface ILoginHelper
Parameters:
oWebData -
oUserSession -
nExpires - cookie expiration time in minutes. -1 means use default value. 0 means don't set an expires time (expire at end of session).
bIsPersistentCookie - false means don't set an expires time (expire at end of session).
bIsSecure - whether or not the login cookie is secure

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". This function creates a valid PTStyleSheetLink by collecting the style sheet name from the user's subportal, and the user's language from the activity space, then forming a PTStyleSheetLink object from this information.

Specified by:
GetStyleSheetLinks in interface ILoginHelper
Parameters:
Pass - in the userSession, this function will look up the stylesheet name from the user's subportal.
Pass - in the ActivitySpace, this function will look up the current user's language.

HandleCOMPlusProcessRecycled

public java.lang.Object HandleCOMPlusProcessRecycled(java.lang.Object userSession)
Checks if the current process has been recycled. This method won't do any further checks if the call to the COM server fails. The assumption is if a check fails then COM+ recycling is not supported

Specified by:
HandleCOMPlusProcessRecycled in interface ILoginHelper
Parameters:
userSession - Current user session
Returns:
An IPTSession created in new COM process with the current user logged in if the current process has been recycled. null if no recycling happened.
See Also:
ILoginHelper.HandleCOMPlusProcessRecycled(java.lang.Object)

GetDropdownMode

public static int GetDropdownMode()
Return the dropdown mode specified in the portal configuration.

Returns:
int dropdownmode



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