public class FMSessionProvider extends Object implements SessionProvider
Modifier and Type | Field and Description |
---|---|
static String |
RANDOM_SECRET
This constant string is used both in this class and
in the Federation Auth Module implementationt to specify
the name of the random secret call back.
|
ATTR_MAP, AUTH_INSTANT, AUTH_LEVEL, AUTH_METHOD, HOST, HOST_NAME, PRINCIPAL_NAME, REALM
Constructor and Description |
---|
FMSessionProvider()
Default Constructor
|
Modifier and Type | Method and Description |
---|---|
void |
addListener(Object session,
SessionListener listener)
Registers a listener for the session.
|
Object |
createSession(Map info,
javax.servlet.http.HttpServletRequest request,
javax.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.
|
String |
getPrincipalName(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.
|
Object |
getSession(javax.servlet.http.HttpServletRequest request)
May be used by both SP and IDP side for getting an existing
session given a browser initiated HTTP request.
|
Object |
getSession(String sessionID)
May be used by both SP and IDP side for getting an existing
session given an session ID.
|
String |
getSessionID(Object session)
The returned session ID should be unique and not
change during the lifetime of this session.
|
long |
getTimeLeft(Object session)
Returns the time left for this session in seconds.
|
void |
invalidateSession(Object session,
javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
May be used by both SP and IDP side to invalidate a session.
|
boolean |
isValid(Object session)
Indicates whether the session is still valid.
|
static boolean |
matchSecret(String secret)
Indicates whether a secret originally comes from this class or not
|
String |
rewriteURL(Object session,
String URL)
Returns rewritten URL.
|
void |
setLoadBalancerCookie(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
Sets a load balancer cookie in the suppled HTTP response.
|
void |
setProperty(Object session,
String name,
String[] values)
Stores a property in the session object.
|
public static final String RANDOM_SECRET
public static boolean matchSecret(String secret)
secret
- the secret string to be matchedpublic Object createSession(Map info, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, StringBuffer targetApplication) throws SessionException
createSession
in interface SessionProvider
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.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.SessionException
- if an error occurred during session
creation.public void setLoadBalancerCookie(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
setLoadBalancerCookie
in interface SessionProvider
request
- The HTTP request.response
- the HttpServletResponse
that will be sent
to the user.public Object getSession(String sessionID) throws SessionException
getSession
in interface SessionProvider
sessionID
- the unique session handle.SessionException
- if an error occurred during session
retrieval.public Object getSession(javax.servlet.http.HttpServletRequest request) throws SessionException
getSession
in interface SessionProvider
request
- the browser initiated HTTP request.SessionException
- if an error occurred during session
retrieval.public void invalidateSession(Object session, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) throws SessionException
invalidateSession
in interface SessionProvider
session
- the session to be invalidatedrequest
- the browser initiated HTTP request.response
- the HTTP response going back to browser.SessionException
- if an error occurred during session
retrieval.public boolean isValid(Object session) throws SessionException
isValid
in interface SessionProvider
session
- Session objectSessionException
public String getSessionID(Object session)
getSessionID
in interface SessionProvider
public String getPrincipalName(Object session) throws SessionException
getPrincipalName
in interface SessionProvider
session
- Session object.SessionException
- if this operation causes an error.public long getTimeLeft(Object session) throws SessionException
SessionProvider
getTimeLeft
in interface SessionProvider
session
- Session object.SessionException
public void setProperty(Object session, String name, String[] values) throws SessionException
setProperty
in interface SessionProvider
session
- the session object.name
- the property name.values
- the property values.SessionException
- if setting the property causes an error.public String[] getProperty(Object session, String name) throws SessionException
getProperty
in interface SessionProvider
session
- the session object.name
- the property name.SessionException
- if getting the property causes an error.public String rewriteURL(Object session, String URL) throws SessionException
SessionProvider
rewriteURL
in interface SessionProvider
session
- the session object.URL
- the URL to be rewritten.SessionException
- if rewritting the URL
causes an error.public void addListener(Object session, SessionListener listener) throws SessionException
SessionException
.addListener
in interface SessionProvider
session
- the session object.listener
- listener for the session invalidation event.SessionException
- if adding the listener caused an error.Copyright © 2010–2025 Open Identity Platform Community. All rights reserved.