Copied over mapping and filtering schemas.
[shibboleth/sp.git] / shibsp / Application.h
1 /*
2  *  Copyright 2001-2007 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/CredentialResolver.h>
29 #include <xmltooling/security/TrustEngine.h>
30
31 namespace shibsp {
32     
33     class SHIBSP_API AttributeExtractor;
34     class SHIBSP_API AttributeResolver;
35     class SHIBSP_API Handler;
36     class SHIBSP_API ServiceProvider;
37     class SHIBSP_API SessionInitiator;
38
39     /**
40      * Interface to a Shibboleth Application instance.
41      * 
42      * <p>An Application is a logical set of resources that act as a unit
43      * of session management and policy.
44      */
45     class SHIBSP_API Application : public virtual PropertySet
46     {
47         MAKE_NONCOPYABLE(Application);
48     protected:
49         Application() {}
50     public:
51         virtual ~Application() {}
52
53         /**
54          * Returns the owning ServiceProvider instance.
55          *
56          * @return a locked ServiceProvider
57          */
58         virtual const ServiceProvider& getServiceProvider() const=0;
59
60         /**
61          * Returns the Application's ID.
62          * 
63          * @return  the ID
64          */        
65         virtual const char* getId() const=0;
66
67         /**
68          * Returns a unique hash for the Application.
69          * 
70          * @return a value resulting from a hash of the Application's ID  
71          */
72         virtual const char* getHash() const=0;
73
74         /**
75          * Returns the name and cookie properties to use for this Application.
76          * 
77          * @param prefix    a value to prepend to the base cookie name
78          * @return  a pair containing the cookie name and the string to append to the cookie value
79          */
80         virtual std::pair<std::string,const char*> getCookieNameProps(const char* prefix) const;
81
82         /**
83          * Returns a MetadataProvider for use with this Application.
84          * 
85          * @return  a MetadataProvider instance, or NULL
86          */
87         virtual opensaml::saml2md::MetadataProvider* getMetadataProvider() const=0;
88         
89         /**
90          * Returns a TrustEngine for use with this Application.
91          * 
92          * @return  a TrustEngine instance, or NULL
93          */
94         virtual xmltooling::TrustEngine* getTrustEngine() const=0;
95
96         /**
97          * Returns an AttributeExtractor for use with this Application.
98          * 
99          * @return  an AttributeExtractor, or NULL
100          */
101         virtual AttributeExtractor* getAttributeExtractor() const=0;
102
103         /**
104          * Returns an AttributeResolver for use with this Application.
105          * 
106          * @return  an AttributeResolver, or NULL
107          */
108         virtual AttributeResolver* getAttributeResolver() const=0;
109
110         /**
111          * Returns the CredentialResolver instance associated with this Application.
112          * 
113          * @return  a CredentialResolver, or NULL
114          */
115         virtual xmltooling::CredentialResolver* getCredentialResolver() const=0;
116
117         /**
118          * Returns configuration properties governing security interactions with a peer.
119          * 
120          * @param provider  a peer entity's metadata
121          * @return  the applicable PropertySet
122          */
123         virtual const PropertySet* getRelyingParty(const opensaml::saml2md::EntityDescriptor* provider) const=0;
124
125         /**
126          * Returns the default SessionInitiator when automatically requesting a session.
127          * 
128          * @return the default SessionInitiator, or NULL
129          */
130         virtual const SessionInitiator* getDefaultSessionInitiator() const=0;
131         
132         /**
133          * Returns a SessionInitiator with a particular ID when automatically requesting a session.
134          * 
135          * @param id    an identifier unique to the Application
136          * @return the designated SessionInitiator, or NULL
137          */
138         virtual const SessionInitiator* getSessionInitiatorById(const char* id) const=0;
139         
140         /**
141          * Returns the default AssertionConsumerService Handler
142          * for use in AuthnRequest messages.
143          * 
144          * @return the default AssertionConsumerService, or NULL
145          */
146         virtual const Handler* getDefaultAssertionConsumerService() const=0;
147
148         /**
149          * Returns an AssertionConsumerService Handler with a particular index
150          * for use in AuthnRequest messages.
151          * 
152          * @param index an index unique to an application
153          * @return the designated AssertionConsumerService, or NULL
154          */
155         virtual const Handler* getAssertionConsumerServiceByIndex(unsigned short index) const=0;
156
157         /**
158          * Returns one or more AssertionConsumerService Handlers that support
159          * a particular protocol binding.
160          * 
161          * @param binding   a protocol binding identifier
162          * @return a set of qualifying AssertionConsumerServices
163          */
164         virtual const std::vector<const Handler*>& getAssertionConsumerServicesByBinding(const XMLCh* binding) const=0;
165         
166         /**
167          * Returns the Handler associated with a particular path/location.
168          * 
169          * @param path  the PATH_INFO appended to the end of a base Handler location
170          *              that invokes the Handler
171          * @return the mapped Handler, or NULL 
172          */
173         virtual const Handler* getHandler(const char* path) const=0;
174
175         /**
176          * Returns the set of audience values associated with this Application.
177          * 
178          * @return set of audience values associated with the Application
179          */
180         virtual const std::vector<const XMLCh*>& getAudiences() const=0;
181     };
182 };
183
184 #endif /* __shibsp_app_h__ */