2 * Licensed to the University Corporation for Advanced Internet
3 * Development, Inc. (UCAID) under one or more contributor license
4 * agreements. See the NOTICE file distributed with this work for
5 * additional information regarding copyright ownership.
7 * UCAID licenses this file to you under the Apache License,
8 * Version 2.0 (the "License"); you may not use this file except
9 * in compliance with the License. You may obtain a copy of the
12 * http://www.apache.org/licenses/LICENSE-2.0
14 * Unless required by applicable law or agreed to in writing,
15 * software distributed under the License is distributed on an
16 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
17 * either express or implied. See the License for the specific
18 * language governing permissions and limitations under the License.
22 * @file shibsp/SessionCacheEx.h
24 * Extended SessionCache API with additional capabilities
27 #ifndef __shibsp_sessioncacheex_h__
28 #define __shibsp_sessioncacheex_h__
30 #include <shibsp/SessionCache.h>
35 * Extended SessionCache API with additional capabilities
37 class SHIBSP_API SessionCacheEx : public SessionCache
42 virtual ~SessionCacheEx();
46 * Returns active sessions that match particular parameters and records the logout
47 * to prevent race conditions.
49 * <p>On exit, the mapping between these sessions and the associated information MAY be
50 * removed by the cache, so subsequent calls to this method may not return anything.
52 * <p>Until logout expiration, any attempt to create a session with the same parameters
53 * will be blocked by the cache.
55 * @param application reference to Application that owns the session(s)
56 * @param issuer source of session(s)
57 * @param nameid name identifier associated with the session(s) to terminate
58 * @param indexes indexes of sessions, or nullptr for all sessions associated with other parameters
59 * @param expires logout expiration
60 * @param sessions on exit, contains the IDs of the matching sessions found
62 virtual std::vector<std::string>::size_type logout(
63 const Application& application,
64 const opensaml::saml2md::EntityDescriptor* issuer,
65 const opensaml::saml2::NameID& nameid,
66 const std::set<std::string>* indexes,
68 std::vector<std::string>& sessions
73 * Locates an existing session by ID.
75 * <p>If the client address is supplied, then a check will be performed against
76 * the address recorded in the record.
78 * @param application reference to Application that owns the Session
79 * @param key session key
80 * @param client_addr network address of client (if known)
81 * @param timeout inactivity timeout to enforce (0 for none, nullptr to bypass check/update of last access)
82 * @return pointer to locked Session, or nullptr
84 virtual Session* find(const Application& application, const char* key, const char* client_addr=nullptr, time_t* timeout=nullptr)=0;
87 * Deletes an existing session.
89 * @param application reference to Application that owns the Session
90 * @param key session key
92 virtual void remove(const Application& application, const char* key)=0;
96 #endif /* __shibsp_sessioncacheex_h__ */