com.ibm.portal.portletservice.rememberme
Interface RememberMeCookieService

All Superinterfaces:
PortletService

public interface RememberMeCookieService
extends PortletService

Portlet service for JSR compliant portlets to leverage the remember me cookie functionality of WebSphere Portal.

The following sample shows how to perform the JNDI lookup to acquire a service object:

          com.ibm.portal.portlet.service.PortletServiceHome psh;
          javax.naming.Context ctx = new javax.naming.InitialContext();
                
          try { 
              psh = (PortletServiceHome) ctx.lookup(RememberMeCookieService.JNDI_NAME);
          } catch(javax.naming.NameNotFoundException ex) {
              // error handling
          }
                  
          // obtain the service object and use the service 
          RememberMeCookieService rememberMeCookieService = (RememberMeCookieService) psh.getPortletService(RememberMeCookieService.class);
          if (rememberMeCookieService.isRememberMeCookieEnabled()) {
              // ...
          }
 

Since:
6.1

Field Summary
static java.lang.String JNDI_NAME
           
 
Method Summary
 com.ibm.portal.state.DisposableURL getInvalidateCookieURL(javax.portlet.RenderRequest renderReq, javax.portlet.RenderResponse renderResp)
          Returns a URL that triggers the invalidation of the remember me cookie.
 java.lang.String getUserID(javax.portlet.PortletRequest portletReq)
          Returns the user ID that is extracted from the remember me cookie.
 boolean isCookieSet(javax.portlet.PortletRequest portletReq)
          Returns false if the remember me cookie does not exist in the current request, true if the remember me cookie exists in the current request. This method does not validate cookie content, instead it checks the sheer existence in the passed request.
 boolean isRememberMeCookieEnabled()
          Returns true if the remember me cookie functionality is enabled and all components started successfully, false if the remember me cookie functionality is not available.
 

Field Detail

JNDI_NAME

static final java.lang.String JNDI_NAME
See Also:
Constant Field Values
Method Detail

isRememberMeCookieEnabled

boolean isRememberMeCookieEnabled()
Returns


isCookieSet

boolean isCookieSet(javax.portlet.PortletRequest portletReq)
                    throws SecurityException
Returns This method does not validate cookie content, instead it checks the sheer existence in the passed request.

Parameters:
portletReq - The current PortletRequest.
Returns:
A boolean indicating whether a remember me cookie is found in the current request.
Throws:
SecurityException - If an unrecoverable problem occurs.
java.lang.UnsupportedOperationException - If the remember me cookie functionality is not available.

getUserID

java.lang.String getUserID(javax.portlet.PortletRequest portletReq)
                           throws SecurityException
Returns the user ID that is extracted from the remember me cookie. Returns null if the cookie does not exist in the current request.

Parameters:
portletReq - The current PortletRequest.
Returns:
The DN of the remembered user.
Throws:
SecurityException - If an unrecoverable problem occurs.
java.lang.UnsupportedOperationException - If the remember me cookie functionality is not available.

getInvalidateCookieURL

com.ibm.portal.state.DisposableURL getInvalidateCookieURL(javax.portlet.RenderRequest renderReq,
                                                          javax.portlet.RenderResponse renderResp)
                                                          throws SecurityException
Returns a URL that triggers the invalidation of the remember me cookie. May return null in the case that it was not possible to create the URL.
After the remember me cookie was invalidated using the returned URL, a redirection is made to the same portal page from which the URL was invoked. In the course of this redirection the cookie will be revoked.

Parameters:
renderReq - The current RenderRequest.
renderResp - The current RenderResponse.
Returns:
The URL to trigger the invalidation of the remember me cookie or null.
Throws:
java.lang.UnsupportedOperationException - If the remember me cookie functionality is not available.
SecurityException - If an unrecoverable problem occurs.