Large reorg of shibsp lib, new SPRequest API, ported modules, shifted code out of...
[shibboleth/sp.git] / shibsp / Application.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/Application.h
19  * 
20  * Interface to a Shibboleth Application instance.
21  */
22
23 #ifndef __shibsp_app_h__
24 #define __shibsp_app_h__
25
26 #include <shibsp/util/PropertySet.h>
27 #include <saml/saml2/metadata/MetadataProvider.h>
28 #include <xmltooling/security/TrustEngine.h>
29
30 namespace shibsp {
31
32     /**
33      * Interface to a Shibboleth Application instance.
34      * 
35      * <p>An Application is a logical set of resources that act as a unit
36      * of session management and policy.
37      */
38     class SHIBSP_API Application : public virtual PropertySet
39     {
40         MAKE_NONCOPYABLE(Application);
41     protected:
42         Application() {}
43     public:
44         virtual ~Application() {}
45
46         /**
47          * Returns the Application's ID.
48          * 
49          * @return  the ID
50          */        
51         virtual const char* getId() const=0;
52
53         /**
54          * Returns a unique hash for the Application.
55          * 
56          * @return a value resulting from a hash of the Application's ID  
57          */
58         virtual const char* getHash() const=0;
59
60         /**
61          * Returns the name and cookie properties to use for this Application.
62          * 
63          * @param prefix    a value to prepend to the base cookie name
64          * @return  a pair containing the cookie name and the string to append to the cookie value
65          */
66         virtual std::pair<std::string,const char*> getCookieNameProps(const char* prefix) const;
67
68         /**
69          * Returns a MetadataProvider for use with this Application.
70          * 
71          * @return  a MetadataProvider instance, or NULL
72          */
73         virtual opensaml::saml2md::MetadataProvider* getMetadataProvider() const=0;
74         
75         /**
76          * Returns a TrustEngine for use with this Application.
77          * 
78          * @return  a TrustEngine instance, or NULL
79          */
80         virtual xmltooling::TrustEngine* getTrustEngine() const=0;
81         
82         /**
83          * Returns configuration properties governing security interactions with a peer entity.
84          * 
85          * @param provider  a peer entity's metadata
86          * @return  the applicable PropertySet
87          */
88         virtual const shibsp::PropertySet* getCredentialUse(const opensaml::saml2md::EntityDescriptor* provider) const=0;
89     };
90 };
91
92 #endif /* __shibsp_app_h__ */