com.force.sdk.oauth.context
Class SecurityContextUtil

java.lang.Object
  extended by com.force.sdk.oauth.context.SecurityContextUtil

public final class SecurityContextUtil
extends Object

This utility class is in place to handle all interaction with the browser cookies that will be used to track a user's authentication status. This will include the logic required to refresh the security context if it isn't available in the server side session.

Author:
John Simone

Field Summary
static String DEFAULT_ROLE
          Constant that defines the default role which will be used if no role is available.
static String FORCE_FORCE_ENDPOINT
          Constant that defines the name of the endpoint cookie.
static String FORCE_FORCE_SESSION
          Constant that defines the name of the session id cookie.
 
Method Summary
static void clearCookieValues(javax.servlet.http.HttpServletResponse response)
          Clear the endpoint and session cookies.
static Map<String,String> getCookieValues(javax.servlet.http.HttpServletRequest request)
          Get the session id and endpoint out of cookies.
static void initializeSecurityContextFromApi(SecurityContext securityContext)
          Initializes the user information into the security context via a call to the partner API.
static void setCookieValues(Map<String,String> cookieValueMap, javax.servlet.http.HttpServletResponse response, boolean secure)
          Set the map of cookie names and values into cookies on the response.
static void setCookieValues(SecurityContext sc, javax.servlet.http.HttpServletResponse response, boolean secure)
          Set the session id and endpoint from the security context into cookies.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

FORCE_FORCE_SESSION

public static final String FORCE_FORCE_SESSION
Constant that defines the name of the session id cookie.

See Also:
Constant Field Values

FORCE_FORCE_ENDPOINT

public static final String FORCE_FORCE_ENDPOINT
Constant that defines the name of the endpoint cookie.

See Also:
Constant Field Values

DEFAULT_ROLE

public static final String DEFAULT_ROLE
Constant that defines the default role which will be used if no role is available.

See Also:
Constant Field Values
Method Detail

getCookieValues

public static Map<String,String> getCookieValues(javax.servlet.http.HttpServletRequest request)
Get the session id and endpoint out of cookies.

Parameters:
request - HttpServletRequest
Returns:
Map - cookie name, cookie value

setCookieValues

public static void setCookieValues(SecurityContext sc,
                                   javax.servlet.http.HttpServletResponse response,
                                   boolean secure)
Set the session id and endpoint from the security context into cookies.

Parameters:
sc - SecurityContext
response - HttpServletResponse
secure - Whether or not the cookie should be secure

setCookieValues

public static void setCookieValues(Map<String,String> cookieValueMap,
                                   javax.servlet.http.HttpServletResponse response,
                                   boolean secure)
Set the map of cookie names and values into cookies on the response.

Parameters:
cookieValueMap - Map - cookie name, cookie value
response - HttpServletResponse
secure - Whether or not the cookie should be secure

clearCookieValues

public static void clearCookieValues(javax.servlet.http.HttpServletResponse response)
Clear the endpoint and session cookies.

Parameters:
response - HttpServletResponse

initializeSecurityContextFromApi

public static void initializeSecurityContextFromApi(SecurityContext securityContext)
                                             throws com.sforce.ws.ConnectionException
Initializes the user information into the security context via a call to the partner API.

Parameters:
securityContext - securityContext
Throws:
com.sforce.ws.ConnectionException - ConnectionException


Copyright © 2011. All Rights Reserved.