Class FedletSessionProvider
- java.lang.Object
-
- com.sun.identity.plugin.session.impl.FedletSessionProvider
-
- All Implemented Interfaces:
SessionProvider
public class FedletSessionProvider extends Object implements SessionProvider
TheFedletSessionProviderclass is an implementation ofSessionProviderinterface for Fedlet deployment. The implementation performs no operation on the methods.
-
-
Field Summary
-
Fields inherited from interface com.sun.identity.plugin.session.SessionProvider
ATTR_MAP, AUTH_INSTANT, AUTH_LEVEL, AUTH_METHOD, HOST, HOST_NAME, PRINCIPAL_NAME, REALM
-
-
Constructor Summary
Constructors Constructor Description FedletSessionProvider()Default Constructor
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddListener(Object session, SessionListener listener)Registers a listener for the session.ObjectcreateSession(Map info, jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, StringBuffer targetApplication)Meaningful only for SP side, the implementation of this method will create a local session for the local user identified by the information in the map.StringgetPrincipalName(Object session)Returns princiapl name, or user name given the session object.String[]getProperty(Object session, String name)Retrieves a property from the session object.ObjectgetSession(jakarta.servlet.http.HttpServletRequest request)May be used by both SP and IDP side for getting an existing session given a browser initiated HTTP request.ObjectgetSession(String sessionID)May be used by both SP and IDP side for getting an existing session given an session ID.StringgetSessionID(Object session)The returned session ID should be unique and not change during the lifetime of this session.longgetTimeLeft(Object session)Returns the time left for this session in seconds.voidinvalidateSession(Object session, jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response)May be used by both SP and IDP side to invalidate a session.booleanisValid(Object session)Indicates whether the session is still valid.static booleanmatchSecret(String secret)Indicates whether a secret originally comes from this class or notStringrewriteURL(Object session, String URL)Returns rewritten URL.voidsetLoadBalancerCookie(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response)Sets a load balancer cookie in the suppled HTTP response.voidsetProperty(Object session, String name, String[] values)Stores a property in the session object.
-
-
-
Method Detail
-
matchSecret
public static boolean matchSecret(String secret)
Indicates whether a secret originally comes from this class or not- Parameters:
secret- the secret string to be matched- Returns:
- true if there is a match, false otherwise
-
createSession
public Object createSession(Map info, jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, StringBuffer targetApplication) throws SessionException
Meaningful only for SP side, the implementation of this method will create a local session for the local user identified by the information in the map. The underline mechanism of the session creation and management is application specific. For example, it could be cookie setting or url rewriting, which is expected to be done by the implementation of this method. Note that only the first input parameter is mandatory. Normally, at least one of the last two parameters should not be null- Specified by:
createSessionin interfaceSessionProvider- Parameters:
info- a Map with keys and values being of type String; The keys will include "principalName" (returned from SPAccountMapper), "realm", "authLevel", and may include "resourceOffering" and/or "idpEntityID"; The implementation of this method could choose to set some of the information contained in the map into the newly created Session by calling setProperty(), later the target application may consume the information.request- the HttpServletRequest the user made to initiate the SSO; Note that it should be the initial request coming from the browser as opposed to the possible subsequent back-channel HTTP request for delivering SOAP message.response- the HttpServletResponse that will be sent to the user (for example it could be used to set a cookie).targetApplication- the original resource that was requested as the target of the SSO by the end user; If needed, this String could be modified, e.g., by appending query string(s) or by url rewriting, hence this is an in/out parameter.- Returns:
- the newly created local user session.
- Throws:
SessionException- if an error occurred during session creation.
-
getSession
public Object getSession(String sessionID) throws SessionException
May be used by both SP and IDP side for getting an existing session given an session ID.- Specified by:
getSessionin interfaceSessionProvider- Parameters:
sessionID- the unique session handle.- Returns:
- the corresponding session object.
- Throws:
SessionException- if an error occurred during session retrieval.
-
getSession
public Object getSession(jakarta.servlet.http.HttpServletRequest request) throws SessionException
May be used by both SP and IDP side for getting an existing session given a browser initiated HTTP request.- Specified by:
getSessionin interfaceSessionProvider- Parameters:
request- the browser initiated HTTP request.- Returns:
- the corresponding session object.
- Throws:
SessionException- if an error occurred during session retrieval.
-
invalidateSession
public void invalidateSession(Object session, jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response) throws SessionException
May be used by both SP and IDP side to invalidate a session. In case of SLO with SOAP, the last two input parameters would have to be null- Specified by:
invalidateSessionin interfaceSessionProvider- Parameters:
session- the session to be invalidatedrequest- the browser initiated HTTP request.response- the HTTP response going back to browser.- Throws:
SessionException- if an error occurred during session retrieval.
-
isValid
public boolean isValid(Object session) throws SessionException
Indicates whether the session is still valid. This is useful for toolkit clean-up thread.- Specified by:
isValidin interfaceSessionProvider- Parameters:
session- Session object- Returns:
- boolean value indicating whether the session is still valid
- Throws:
SessionException
-
getSessionID
public String getSessionID(Object session)
The returned session ID should be unique and not change during the lifetime of this session.- Specified by:
getSessionIDin interfaceSessionProvider- Returns:
- session ID.
-
getPrincipalName
public String getPrincipalName(Object session) throws SessionException
Returns princiapl name, or user name given the session object.- Specified by:
getPrincipalNamein interfaceSessionProvider- Parameters:
session- Session object.- Returns:
- principal name, or user name.
- Throws:
SessionException- if this operation causes an error.
-
setProperty
public void setProperty(Object session, String name, String[] values) throws SessionException
Stores a property in the session object.- Specified by:
setPropertyin interfaceSessionProvider- Parameters:
session- the session object.name- the property name.values- the property values.- Throws:
SessionException- if setting the property causes an error.
-
getProperty
public String[] getProperty(Object session, String name) throws SessionException
Retrieves a property from the session object.- Specified by:
getPropertyin interfaceSessionProvider- Parameters:
session- the session object.name- the property name.- Returns:
- the property values.
- Throws:
SessionException- if getting the property causes an error.
-
rewriteURL
public String rewriteURL(Object session, String URL) throws SessionException
Description copied from interface:SessionProviderReturns rewritten URL. Rewrites an URL with session information in case cookie setting is not supported.- Specified by:
rewriteURLin interfaceSessionProvider- Parameters:
session- the session object.URL- the URL to be rewritten.- Returns:
- the rewritten URL.
- Throws:
SessionException- if rewritting the URL causes an error.
-
addListener
public void addListener(Object session, SessionListener listener) throws SessionException
Registers a listener for the session.- Specified by:
addListenerin interfaceSessionProvider- Parameters:
session- the session object.listener- listener for the session invalidation event.- Throws:
SessionException- if adding the listener caused an error.
-
setLoadBalancerCookie
public void setLoadBalancerCookie(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response)Sets a load balancer cookie in the suppled HTTP response. The load balancer cookie's value is set per server instance and is used to support sticky load balancing.- Specified by:
setLoadBalancerCookiein interfaceSessionProvider- Parameters:
request- The HTTP request.response- theHttpServletResponsethat will be sent to the user.
-
getTimeLeft
public long getTimeLeft(Object session)
Description copied from interface:SessionProviderReturns the time left for this session in seconds.- Specified by:
getTimeLeftin interfaceSessionProvider- Parameters:
session- Session object.- Returns:
- The time left for this session.
-
-