shibboleth-3.0.1
shibsp::SessionCache Class Referenceabstract

Creates and manages user sessions. More...

#include <shibsp/SessionCache.h>

Inheritance diagram for shibsp::SessionCache:
shibsp::SSCache

Public Member Functions

virtual void insert (std::string &sessionID, const Application &application, const xmltooling::HTTPRequest &httpRequest, xmltooling::HTTPResponse &httpResponse, time_t expires, const opensaml::saml2md::EntityDescriptor *issuer=nullptr, const XMLCh *protocol=nullptr, const opensaml::saml2::NameID *nameid=nullptr, const XMLCh *authn_instant=nullptr, const XMLCh *session_index=nullptr, const XMLCh *authncontext_class=nullptr, const XMLCh *authncontext_decl=nullptr, const std::vector< const opensaml::Assertion * > *tokens=nullptr, const std::vector< Attribute * > *attributes=nullptr)=0
 Inserts a new session into the cache and binds the session to the outgoing client response. More...
 
virtual bool matches (const Application &application, xmltooling::HTTPRequest &request, const opensaml::saml2md::EntityDescriptor *issuer, const opensaml::saml2::NameID &nameid, const std::set< std::string > *indexes)=0
 Determines whether the Session bound to a client request matches a set of input criteria. More...
 
virtual std::vector
< std::string >::size_type 
logout (const Application &application, const opensaml::saml2md::EntityDescriptor *issuer, const opensaml::saml2::NameID &nameid, const std::set< std::string > *indexes, time_t expires, std::vector< std::string > &sessions)=0
 Returns active sessions that match particular parameters and records the logout to prevent race conditions. More...
 
virtual void test ()=0
 Executes a test of the cache's general health.
 
virtual std::string active (const Application &application, const xmltooling::HTTPRequest &request)=0
 Returns the ID of the session bound to the specified client request, if possible. More...
 
virtual Sessionfind (const Application &application, xmltooling::HTTPRequest &request, const char *client_addr=nullptr, time_t *timeout=nullptr)=0
 Locates an existing session bound to a request. More...
 
virtual void remove (const Application &application, const xmltooling::HTTPRequest &request, xmltooling::HTTPResponse *response=nullptr, time_t revocationExp=0)=0
 Deletes an existing session bound to a request. More...
 
virtual Sessionfind (const Application &application, const char *key)=0
 Locates an existing session by ID. More...
 
virtual void remove (const Application &application, const char *key, time_t revocationExp=0)=0
 Deletes an existing session. More...
 

Detailed Description

Creates and manages user sessions.

The cache abstracts a persistent (meaning across requests) cache of instances of the Session interface. Creation of new entries and entry lookup are confined to this interface to enable the implementation to remote and/or optimize calls by implementing custom versions of the Session interface as required.

Member Function Documentation

virtual std::string shibsp::SessionCache::active ( const Application application,
const xmltooling::HTTPRequest &  request 
)
pure virtual

Returns the ID of the session bound to the specified client request, if possible.

Parameters
applicationreference to Application that owns the Session
requestrequest from client containing session, or a reference to it
Returns
ID of session, if any known, or an empty string

Implemented in shibsp::SSCache.

virtual Session* shibsp::SessionCache::find ( const Application application,
xmltooling::HTTPRequest &  request,
const char *  client_addr = nullptr,
time_t *  timeout = nullptr 
)
pure virtual

Locates an existing session bound to a request.

If the client address is supplied, then a check will be performed against the address recorded in the record.

If a bound session is found to have expired, be invalid, etc., and if the request can be used to "clear" the session from subsequent client requests, then it may be cleared.

Parameters
applicationreference to Application that owns the Session
requestrequest from client bound to session
client_addrnetwork address of client (if known)
timeoutinactivity timeout to enforce (0 for none, nullptr to bypass check/update of last access)
Returns
pointer to locked Session, or nullptr

Implemented in shibsp::SSCache.

virtual Session* shibsp::SessionCache::find ( const Application application,
const char *  key 
)
pure virtual

Locates an existing session by ID.

Parameters
applicationreference to Application that owns the Session
keysession key
Returns
pointer to locked Session, or nullptr

Implemented in shibsp::SSCache.

virtual void shibsp::SessionCache::insert ( std::string &  sessionID,
const Application application,
const xmltooling::HTTPRequest &  httpRequest,
xmltooling::HTTPResponse &  httpResponse,
time_t  expires,
const opensaml::saml2md::EntityDescriptor *  issuer = nullptr,
const XMLCh *  protocol = nullptr,
const opensaml::saml2::NameID *  nameid = nullptr,
const XMLCh *  authn_instant = nullptr,
const XMLCh *  session_index = nullptr,
const XMLCh *  authncontext_class = nullptr,
const XMLCh *  authncontext_decl = nullptr,
const std::vector< const opensaml::Assertion * > *  tokens = nullptr,
const std::vector< Attribute * > *  attributes = nullptr 
)
pure virtual

Inserts a new session into the cache and binds the session to the outgoing client response.

The newly created session ID is placed into the first parameter.

The SSO tokens and Attributes remain owned by the caller and are copied by the cache.

Parameters
sessionIDreference to string to capture newly inserted session ID
applicationreference to Application that owns the Session
httpRequestrequest that initiated session
httpResponsecurrent response to client
expiresexpiration time of session
issuerissuing metadata of assertion issuer, if known
protocolprotocol family used to initiate the session
nameidprincipal identifier, normalized to SAML 2, if any
authn_instantUTC timestamp of authentication at IdP, if known
session_indexindex of session between principal and IdP, if any
authncontext_classmethod/category of authentication event, if known
authncontext_declspecifics of authentication event, if known
tokensassertions to cache with session, if any
attributesoptional array of resolved Attributes to cache with session

Implemented in shibsp::SSCache.

virtual std::vector<std::string>::size_type shibsp::SessionCache::logout ( const Application application,
const opensaml::saml2md::EntityDescriptor *  issuer,
const opensaml::saml2::NameID &  nameid,
const std::set< std::string > *  indexes,
time_t  expires,
std::vector< std::string > &  sessions 
)
pure virtual

Returns active sessions that match particular parameters and records the logout to prevent race conditions.

On exit, the mapping between these sessions and the associated information MAY be removed by the cache, so subsequent calls to this method may not return anything.

Until logout expiration, any attempt to create a session with the same parameters will be blocked by the cache.

Parameters
applicationreference to Application that owns the session(s)
issuersource of session(s)
nameidname identifier associated with the session(s) to terminate
indexesindexes of sessions, or nullptr for all sessions associated with other parameters
expireslogout expiration
sessionson exit, contains the IDs of the matching sessions found

Implemented in shibsp::SSCache.

virtual bool shibsp::SessionCache::matches ( const Application application,
xmltooling::HTTPRequest &  request,
const opensaml::saml2md::EntityDescriptor *  issuer,
const opensaml::saml2::NameID &  nameid,
const std::set< std::string > *  indexes 
)
pure virtual

Determines whether the Session bound to a client request matches a set of input criteria.

Parameters
applicationreference to Application that owns the Session
requestrequest in which to locate Session
issuerrequired source of session(s)
nameidrequired name identifier
indexessession indexes
Returns
true iff the Session exists and matches the input criteria

Implemented in shibsp::SSCache.

virtual void shibsp::SessionCache::remove ( const Application application,
const xmltooling::HTTPRequest &  request,
xmltooling::HTTPResponse *  response = nullptr,
time_t  revocationExp = 0 
)
pure virtual

Deletes an existing session bound to a request.

Revocation may be supported by some implementations.

Parameters
applicationreference to Application that owns the Session
requestrequest from client containing session, or a reference to it
responseoptional response to client enabling removal of session or reference
revocationExpoptional indicator for length of time to track revocation of this session

Implemented in shibsp::SSCache.

virtual void shibsp::SessionCache::remove ( const Application application,
const char *  key,
time_t  revocationExp = 0 
)
pure virtual

Deletes an existing session.

Revocation may be supported by some implementations.

Parameters
applicationreference to Application that owns the Session
keysession key
revocationExpoptional indicator for length of time to track revocation of this session

Implemented in shibsp::SSCache.


The documentation for this class was generated from the following file: