Starting to refactor session cache, eliminated IConfig class.
[shibboleth/cpp-sp.git] / shibsp / SessionCache.h
1 /*
2  *  Copyright 2001-2006 Internet2
3  * 
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
7  *
8  *     http://www.apache.org/licenses/LICENSE-2.0
9  *
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.
15  */
16
17 /**
18  * @file shibsp/SessionCache.h
19  * 
20  * Caches and manages user sessions
21  */
22
23 #ifndef __shibsp_sessioncache_h__
24 #define __shibsp_sessioncache_h__
25
26 #include <xmltooling/Lockable.h>
27 #include <xercesc/dom/DOM.hpp>
28
29 namespace shibsp {
30
31     class SHIBSP_API Application;
32
33     class SHIBSP_API Session : public virtual xmltooling::Lockable
34     {
35         MAKE_NONCOPYABLE(Session);
36     protected:
37         Session() {}
38         virtual ~Session() {}
39     public:
40         /* TODO: design new interface, probably with version-specific subinterfaces
41         virtual const char* getClientAddress() const=0;
42         virtual const char* getProviderId() const=0;
43         virtual std::pair<const char*,const saml::SAMLSubject*> getSubject(bool xml=true, bool obj=false) const=0;
44         virtual const char* getAuthnContext() const=0;
45         virtual std::pair<const char*,const saml::SAMLResponse*> getTokens(bool xml=true, bool obj=false) const=0;
46         virtual std::pair<const char*,const saml::SAMLResponse*> getFilteredTokens(bool xml=true, bool obj=false) const=0;
47         */
48     };
49     
50     /**
51      * Creates and manages user sessions
52      * 
53      * The cache abstracts a persistent (meaning across requests) cache of
54      * instances of the Session interface. Creation of new entries and entry
55      * lookup are confined to this interface to enable the implementation to
56      * remote and/or optimize calls by implementing custom versions of the
57      * Session interface as required.
58      */
59     class SHIBSP_API SessionCache
60     {
61         MAKE_NONCOPYABLE(SessionCache);
62     protected:
63         SessionCache() {}
64     public:
65         virtual ~SessionCache() {}
66     };
67
68     /**
69      * Registers SessionCache classes into the runtime.
70      */
71     void SHIBSP_API registerSessionCaches();
72 };
73
74 #endif /* __shibsp_sessioncache_h__ */