2 * Copyright 2001-2007 Internet2
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
18 * @file shibsp/SessionCacheEx.h
20 * Extended SessionCache API with additional capabilities
23 #ifndef __shibsp_sessioncacheex_h__
24 #define __shibsp_sessioncacheex_h__
26 #include <shibsp/SessionCache.h>
31 * Extended SessionCache API with additional capabilities
33 class SHIBSP_API SessionCacheEx : public SessionCache
38 virtual ~SessionCacheEx() {}
42 * Returns active sessions that match particular parameters and records the logout
43 * to prevent race conditions.
45 * <p>On exit, the mapping between these sessions and the associated information MAY be
46 * removed by the cache, so subsequent calls to this method may not return anything.
48 * <p>Until logout expiration, any attempt to create a session with the same parameters
49 * will be blocked by the cache.
51 * @param application reference to Application that owns the session(s)
52 * @param issuer source of session(s)
53 * @param nameid name identifier associated with the session(s) to terminate
54 * @param indexes indexes of sessions, or NULL for all sessions associated with other parameters
55 * @param expires logout expiration
56 * @param sessions on exit, contains the IDs of the matching sessions found
58 virtual std::vector<std::string>::size_type logout(
59 const Application& application,
60 const opensaml::saml2md::EntityDescriptor* issuer,
61 const opensaml::saml2::NameID& nameid,
62 const std::set<std::string>* indexes,
64 std::vector<std::string>& sessions
69 * Locates an existing session by ID.
71 * <p>If the client address is supplied, then a check will be performed against
72 * the address recorded in the record.
74 * @param application reference to Application that owns the Session
75 * @param key session key
76 * @param client_addr network address of client (if known)
77 * @param timeout inactivity timeout to enforce (0 for none, NULL to bypass check/update of last access)
78 * @return pointer to locked Session, or NULL
80 virtual Session* find(const Application& application, const char* key, const char* client_addr=NULL, time_t* timeout=NULL)=0;
83 * Deletes an existing session.
85 * @param application reference to Application that owns the Session
86 * @param key session key
88 virtual void remove(const Application& application, const char* key)=0;
92 #endif /* __shibsp_sessioncacheex_h__ */