Pulled attribute designators, moved audiences up.
[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     class SHIBSP_API Handler;
33
34     /**
35      * Interface to a Shibboleth Application instance.
36      * 
37      * <p>An Application is a logical set of resources that act as a unit
38      * of session management and policy.
39      */
40     class SHIBSP_API Application : public virtual PropertySet
41     {
42         MAKE_NONCOPYABLE(Application);
43     protected:
44         Application() {}
45     public:
46         virtual ~Application() {}
47
48         /**
49          * Returns the Application's ID.
50          * 
51          * @return  the ID
52          */        
53         virtual const char* getId() const=0;
54
55         /**
56          * Returns a unique hash for the Application.
57          * 
58          * @return a value resulting from a hash of the Application's ID  
59          */
60         virtual const char* getHash() const=0;
61
62         /**
63          * Returns the name and cookie properties to use for this Application.
64          * 
65          * @param prefix    a value to prepend to the base cookie name
66          * @return  a pair containing the cookie name and the string to append to the cookie value
67          */
68         virtual std::pair<std::string,const char*> getCookieNameProps(const char* prefix) const;
69
70         /**
71          * Returns a MetadataProvider for use with this Application.
72          * 
73          * @return  a MetadataProvider instance, or NULL
74          */
75         virtual opensaml::saml2md::MetadataProvider* getMetadataProvider() const=0;
76         
77         /**
78          * Returns a TrustEngine for use with this Application.
79          * 
80          * @return  a TrustEngine instance, or NULL
81          */
82         virtual xmltooling::TrustEngine* getTrustEngine() const=0;
83         
84         /**
85          * Returns configuration properties governing security interactions with a peer entity.
86          * 
87          * @param provider  a peer entity's metadata
88          * @return  the applicable PropertySet
89          */
90         virtual const PropertySet* getCredentialUse(const opensaml::saml2md::EntityDescriptor* provider) const=0;
91
92         /**
93          * Returns the default SessionInitiator Handler when automatically
94          * requesting a session.
95          * 
96          * @return the default SessionInitiator, or NULL
97          */
98         virtual const Handler* getDefaultSessionInitiator() const=0;
99         
100         /**
101          * Returns a SessionInitiator Handler with a particular ID when automatically
102          * requesting a session.
103          * 
104          * @param id    an identifier unique to the Application
105          * @return the designated SessionInitiator, or NULL
106          */
107         virtual const Handler* getSessionInitiatorById(const char* id) const=0;
108         
109         /**
110          * Returns the default AssertionConsumerService Handler
111          * for use in AuthnRequest messages.
112          * 
113          * @return the default AssertionConsumerService, or NULL
114          */
115         virtual const Handler* getDefaultAssertionConsumerService() const=0;
116
117         /**
118          * Returns an AssertionConsumerService Handler with a particular index
119          * for use in AuthnRequest messages.
120          * 
121          * @param index an index unique to an application
122          * @return the designated AssertionConsumerService, or NULL
123          */
124         virtual const Handler* getAssertionConsumerServiceByIndex(unsigned short index) const=0;
125
126         /**
127          * Returns one or more AssertionConsumerService Handlers that support
128          * a particular protocol binding.
129          * 
130          * @param binding   a protocol binding identifier
131          * @return a set of qualifying AssertionConsumerServices
132          */
133         virtual const std::vector<const Handler*>& getAssertionConsumerServicesByBinding(const XMLCh* binding) const=0;
134         
135         /**
136          * Returns the Handler associated with a particular path/location.
137          * 
138          * @param path  the PATH_INFO appended to the end of a base Handler location
139          *              that invokes the Handler
140          * @return the mapped Handler, or NULL 
141          */
142         virtual const Handler* getHandler(const char* path) const=0;
143
144         /**
145          * Returns the set of audience values associated with this Application.
146          * 
147          * @return set of audience values associated with the Application
148          */
149         virtual const std::vector<const XMLCh*>& getAudiences() const=0;
150     };
151 };
152
153 #endif /* __shibsp_app_h__ */