atg.userprofiling
Class CookieManager

java.lang.Object
  extended by atg.nucleus.logging.VariableArgumentApplicationLoggingImpl
      extended by atg.nucleus.GenericService
          extended by atg.userprofiling.CookieManager
All Implemented Interfaces:
NameContextBindingListener, NameContextElement, NameResolver, AdminableService, ApplicationLogging, atg.nucleus.logging.ApplicationLoggingSender, atg.nucleus.logging.TraceApplicationLogging, atg.nucleus.logging.VariableArgumentApplicationLogging, ComponentNameResolver, Service, ServiceListener, ProfileRequestConstants, java.util.EventListener

public class CookieManager
extends GenericService
implements ProfileRequestConstants


Field Summary
static java.lang.String CLASS_VERSION
          Class version string
 
Fields inherited from class atg.nucleus.GenericService
SERVICE_INFO_KEY
 
Fields inherited from interface atg.userprofiling.ProfileRequestConstants
PROFILE_PARAMETER_NAME, PROFILE_VERFICATION_PARAMETER_NAME
 
Fields inherited from interface atg.nucleus.logging.TraceApplicationLogging
DEFAULT_LOG_TRACE_STATUS
 
Fields inherited from interface atg.nucleus.logging.ApplicationLogging
DEFAULT_LOG_DEBUG_STATUS, DEFAULT_LOG_ERROR_STATUS, DEFAULT_LOG_INFO_STATUS, DEFAULT_LOG_WARNING_STATUS
 
Constructor Summary
CookieManager()
          Constructs an instanceof CookieManager
 
Method Summary
 boolean cookieProfileIdValid(java.lang.String pProfileId, DynamoHttpServletRequest pRequest, DynamoHttpServletResponse pResponse)
          Returns true if the supplied profile id is valid, based on the verification cookie.
 void expireProfileCookies(Profile pProfile, DynamoHttpServletRequest pRequest, DynamoHttpServletResponse pResponse)
          Sends cookie out on the request to expire any existing profile cookies
 java.lang.String extractProfileId(DynamoHttpServletRequest pRequest, DynamoHttpServletResponse pResponse)
          Attempts to extract the profile id out of the cookies
 void forceProfileCookies(Profile pProfile, DynamoHttpServletRequest pRequest, DynamoHttpServletResponse pResponse)
          Forces the response to contain new profile cookies.
protected  java.lang.String generateIdChecksum(java.lang.String pId)
          Returns a checksum of the given Id which can be used to determine if the profile id cookie has been tampered with
 java.lang.String getCookieHashKey()
          Returns property CookieHashKey
 java.lang.String getProfileCookieComment()
          Returns property ProfileCookieComment
 java.lang.String getProfileCookieDomain()
          Returns property ProfileCookieDomain
 int getProfileCookieMaxAge()
          Returns property ProfileCookieMaxAge
 java.lang.String getProfileCookiePath()
          Returns property ProfileCookiePath
 boolean isExpireProfileCookiesOnLogout()
          Returns property ExpireProfileCookiesOnLogout
 boolean isProfileCookieSecure()
          Returns property ProfileCookieSecure
 boolean isSendProfileCookies()
          Returns property SendProfileCookies
 void sendProfileCookies(Profile pProfile, DynamoHttpServletRequest pRequest, DynamoHttpServletResponse pResponse)
          Sends the specified profile id as a cookie.
 void setCookieHashKey(java.lang.String pCookieHashKey)
          Sets property CookieHashKey
 void setExpireProfileCookiesOnLogout(boolean pExpireProfileCookiesOnLogout)
          Sets property ExpireProfileCookiesOnLogout
 void setProfileCookieComment(java.lang.String pProfileCookieComment)
          Sets property ProfileCookieComment
 void setProfileCookieDomain(java.lang.String pProfileCookieDomain)
          Sets property ProfileCookieDomain
 void setProfileCookieMaxAge(int pProfileCookieMaxAge)
          Sets property ProfileCookieMaxAge
 void setProfileCookiePath(java.lang.String pProfileCookiePath)
          Sets property ProfileCookiePath
 void setProfileCookieSecure(boolean pProfileCookieSecure)
          Sets property ProfileCookieSecure
 void setSendProfileCookies(boolean pSendProfileCookies)
          Sets property SendProfileCookies
 
Methods inherited from class atg.nucleus.GenericService
addLogListener, createAdminServlet, doStartService, doStopService, getAbsoluteName, getAdminServlet, getLoggingForVlogging, getLogListenerCount, getLogListeners, getName, getNameContext, getNucleus, getRoot, getServiceConfiguration, getServiceInfo, isLoggingDebug, isLoggingError, isLoggingInfo, isLoggingTrace, isLoggingWarning, isRunning, logDebug, logDebug, logDebug, logError, logError, logError, logInfo, logInfo, logInfo, logTrace, logTrace, logTrace, logWarning, logWarning, logWarning, nameContextElementBound, nameContextElementUnbound, removeLogListener, resolveName, resolveName, resolveName, resolveName, sendLogEvent, setLoggingDebug, setLoggingError, setLoggingInfo, setLoggingTrace, setLoggingWarning, setNucleus, setServiceInfo, startService, stopService
 
Methods inherited from class atg.nucleus.logging.VariableArgumentApplicationLoggingImpl
vlogDebug, vlogDebug, vlogDebug, vlogDebug, vlogError, vlogError, vlogError, vlogError, vlogInfo, vlogInfo, vlogInfo, vlogInfo, vlogTrace, vlogTrace, vlogTrace, vlogTrace, vlogWarning, vlogWarning, vlogWarning, vlogWarning
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CLASS_VERSION

public static java.lang.String CLASS_VERSION
Class version string

Constructor Detail

CookieManager

public CookieManager()
Constructs an instanceof CookieManager

Method Detail

setSendProfileCookies

public void setSendProfileCookies(boolean pSendProfileCookies)
Sets property SendProfileCookies


isSendProfileCookies

public boolean isSendProfileCookies()
Returns property SendProfileCookies


setProfileCookieComment

public void setProfileCookieComment(java.lang.String pProfileCookieComment)
Sets property ProfileCookieComment


getProfileCookieComment

public java.lang.String getProfileCookieComment()
Returns property ProfileCookieComment


setProfileCookieDomain

public void setProfileCookieDomain(java.lang.String pProfileCookieDomain)
Sets property ProfileCookieDomain


getProfileCookieDomain

public java.lang.String getProfileCookieDomain()
Returns property ProfileCookieDomain


setProfileCookieMaxAge

public void setProfileCookieMaxAge(int pProfileCookieMaxAge)
Sets property ProfileCookieMaxAge


getProfileCookieMaxAge

public int getProfileCookieMaxAge()
Returns property ProfileCookieMaxAge


setProfileCookiePath

public void setProfileCookiePath(java.lang.String pProfileCookiePath)
Sets property ProfileCookiePath


getProfileCookiePath

public java.lang.String getProfileCookiePath()
Returns property ProfileCookiePath


setProfileCookieSecure

public void setProfileCookieSecure(boolean pProfileCookieSecure)
Sets property ProfileCookieSecure


isProfileCookieSecure

public boolean isProfileCookieSecure()
Returns property ProfileCookieSecure


setCookieHashKey

public void setCookieHashKey(java.lang.String pCookieHashKey)
Sets property CookieHashKey


getCookieHashKey

public java.lang.String getCookieHashKey()
Returns property CookieHashKey


setExpireProfileCookiesOnLogout

public void setExpireProfileCookiesOnLogout(boolean pExpireProfileCookiesOnLogout)
Sets property ExpireProfileCookiesOnLogout


isExpireProfileCookiesOnLogout

public boolean isExpireProfileCookiesOnLogout()
Returns property ExpireProfileCookiesOnLogout


extractProfileId

public java.lang.String extractProfileId(DynamoHttpServletRequest pRequest,
                                         DynamoHttpServletResponse pResponse)
                                  throws javax.servlet.ServletException,
                                         java.io.IOException
Attempts to extract the profile id out of the cookies

Throws:
javax.servlet.ServletException
java.io.IOException

cookieProfileIdValid

public boolean cookieProfileIdValid(java.lang.String pProfileId,
                                    DynamoHttpServletRequest pRequest,
                                    DynamoHttpServletResponse pResponse)
                             throws javax.servlet.ServletException,
                                    java.io.IOException
Returns true if the supplied profile id is valid, based on the verification cookie.

Throws:
javax.servlet.ServletException
java.io.IOException

sendProfileCookies

public void sendProfileCookies(Profile pProfile,
                               DynamoHttpServletRequest pRequest,
                               DynamoHttpServletResponse pResponse)
                        throws javax.servlet.ServletException,
                               java.io.IOException
Sends the specified profile id as a cookie. We only send a cookie if there is no cookie or the given profile has a different id than the cookie coming from the request. In addition the cookie coming into the request is verified to make sure it has not been tampered with.

Throws:
javax.servlet.ServletException - if there was a problem performing the operation
java.io.IOException - if there was a problem performing the operation

forceProfileCookies

public void forceProfileCookies(Profile pProfile,
                                DynamoHttpServletRequest pRequest,
                                DynamoHttpServletResponse pResponse)
                         throws javax.servlet.ServletException,
                                java.io.IOException
Forces the response to contain new profile cookies.

Throws:
javax.servlet.ServletException - if there was a problem performing the operation
java.io.IOException - if there was a problem performing the operation

expireProfileCookies

public void expireProfileCookies(Profile pProfile,
                                 DynamoHttpServletRequest pRequest,
                                 DynamoHttpServletResponse pResponse)
                          throws javax.servlet.ServletException,
                                 java.io.IOException
Sends cookie out on the request to expire any existing profile cookies

Throws:
javax.servlet.ServletException - if there was a problem performing the operation
java.io.IOException - if there was a problem performing the operation

generateIdChecksum

protected java.lang.String generateIdChecksum(java.lang.String pId)
Returns a checksum of the given Id which can be used to determine if the profile id cookie has been tampered with