com.force.sdk.oauth.context.store
Class SecurityContextSessionStore

java.lang.Object
  extended by com.force.sdk.oauth.context.store.SecurityContextSessionStore
All Implemented Interfaces:
SecurityContextStorageService

public class SecurityContextSessionStore
extends Object
implements SecurityContextStorageService

Handles the storage of a SecurityContext via server side session.

Author:
John Simone

Field Summary
static String SECURITY_CONTEXT_SESSION_KEY
          The key used to store the SecurityContext in the session.
 
Constructor Summary
SecurityContextSessionStore()
           
 
Method Summary
 void clearSecurityContext(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
          This invalidates the session when server side sessions are being used for SecurityContext storage.
 SecretKeySpec getSecureKey()
          Retrieves the secret key if one is used in this security context store.
 boolean isContextStored(javax.servlet.http.HttpServletRequest request)
          Detects whether or not there is a security context stored via this storage method.
 SecurityContext retreiveSecurityContext(javax.servlet.http.HttpServletRequest request)
          Retrieves the security context from the session.
 void storeSecurityContext(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, SecurityContext securityContext)
          Stores the security context in the session.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SECURITY_CONTEXT_SESSION_KEY

public static final String SECURITY_CONTEXT_SESSION_KEY
The key used to store the SecurityContext in the session.

See Also:
Constant Field Values
Constructor Detail

SecurityContextSessionStore

public SecurityContextSessionStore()
Method Detail

storeSecurityContext

public void storeSecurityContext(javax.servlet.http.HttpServletRequest request,
                                 javax.servlet.http.HttpServletResponse response,
                                 SecurityContext securityContext)
                          throws ContextStoreException
Stores the security context in the session. Stores the security context. The means of storage will vary by implementation.

Specified by:
storeSecurityContext in interface SecurityContextStorageService
Parameters:
request - HttpServletRequest
response - HttpServletResponse
securityContext - SecurityContext
Throws:
ContextStoreException - ContextStoreException

retreiveSecurityContext

public SecurityContext retreiveSecurityContext(javax.servlet.http.HttpServletRequest request)
                                        throws ContextStoreException
Retrieves the security context from the session. Retrieves the security context. The means of storage will vary by implementation.

Specified by:
retreiveSecurityContext in interface SecurityContextStorageService
Parameters:
request - HttpServletRequest
Returns:
the stored SecurityContext
Throws:
ContextStoreException - ContextStoreException

clearSecurityContext

public void clearSecurityContext(javax.servlet.http.HttpServletRequest request,
                                 javax.servlet.http.HttpServletResponse response)
This invalidates the session when server side sessions are being used for SecurityContext storage. Clears the security context from storage. This won't be relevant for all storage types.

Specified by:
clearSecurityContext in interface SecurityContextStorageService
Parameters:
request - HttpServletRequest
response - HttpServletResponse

getSecureKey

public SecretKeySpec getSecureKey()
Description copied from interface: SecurityContextStorageService
Retrieves the secret key if one is used in this security context store.

Specified by:
getSecureKey in interface SecurityContextStorageService
Returns:
SecretKeySpec

isContextStored

public boolean isContextStored(javax.servlet.http.HttpServletRequest request)
Detects whether or not there is a security context stored via this storage method.

Specified by:
isContextStored in interface SecurityContextStorageService
Parameters:
request - HttpServletRequest
Returns:
whether or not the security context is stored using this storage method


Copyright © 2012. All Rights Reserved.