2 * Copyright 2001-2007 Internet2
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
18 * @file shibsp/Application.h
20 * Interface to a Shibboleth Application instance.
23 #ifndef __shibsp_app_h__
24 #define __shibsp_app_h__
26 #include <shibsp/util/PropertySet.h>
30 # include <saml/saml2/metadata/MetadataProvider.h>
31 # include <xmltooling/security/CredentialResolver.h>
32 # include <xmltooling/security/TrustEngine.h>
38 class SHIBSP_API AttributeExtractor;
39 class SHIBSP_API AttributeFilter;
40 class SHIBSP_API AttributeResolver;
42 class SHIBSP_API Handler;
43 class SHIBSP_API ServiceProvider;
44 class SHIBSP_API SessionInitiator;
45 class SHIBSP_API SPRequest;
48 * Interface to a Shibboleth Application instance.
50 * <p>An Application is a logical set of resources that act as a unit
51 * of session management and policy.
53 class SHIBSP_API Application : public virtual PropertySet
55 MAKE_NONCOPYABLE(Application);
59 virtual ~Application() {}
62 * Returns the owning ServiceProvider instance.
64 * @return a locked ServiceProvider
66 virtual const ServiceProvider& getServiceProvider() const=0;
69 * Returns the Application's ID.
73 virtual const char* getId() const=0;
76 * Returns a unique hash for the Application.
78 * @return a value resulting from a computation over the Application's configuration
80 virtual const char* getHash() const=0;
83 * Returns the name and cookie properties to use for this Application.
85 * @param prefix a value to prepend to the base cookie name
86 * @return a pair containing the cookie name and the string to append to the cookie value
88 virtual std::pair<std::string,const char*> getCookieNameProps(const char* prefix) const;
92 * Returns a MetadataProvider for use with this Application.
94 * @param required true iff an exception should be thrown if no MetadataProvider is available
95 * @return a MetadataProvider instance, or NULL
97 virtual opensaml::saml2md::MetadataProvider* getMetadataProvider(bool required=true) const=0;
100 * Returns a TrustEngine for use with this Application.
102 * @param required true iff an exception should be thrown if no TrustEngine is available
103 * @return a TrustEngine instance, or NULL
105 virtual xmltooling::TrustEngine* getTrustEngine(bool required=true) const=0;
108 * Returns an AttributeExtractor for use with this Application.
110 * @return an AttributeExtractor, or NULL
112 virtual AttributeExtractor* getAttributeExtractor() const=0;
115 * Returns an AttributeFilter for use with this Application.
117 * @return an AttributeFilter, or NULL
119 virtual AttributeFilter* getAttributeFilter() const=0;
122 * Returns an AttributeResolver for use with this Application.
124 * @return an AttributeResolver, or NULL
126 virtual AttributeResolver* getAttributeResolver() const=0;
129 * Returns the CredentialResolver instance associated with this Application.
131 * @return a CredentialResolver, or NULL
133 virtual xmltooling::CredentialResolver* getCredentialResolver() const=0;
136 * Returns configuration properties governing security interactions with a peer.
138 * @param provider a peer entity's metadata
139 * @return the applicable PropertySet
141 virtual const PropertySet* getRelyingParty(const opensaml::saml2md::EntityDescriptor* provider) const=0;
144 * Returns the set of audience values associated with this Application.
146 * @return set of audience values associated with the Application
148 virtual const std::vector<const XMLCh*>& getAudiences() const=0;
152 * Returns a set of attribute IDs to use as a REMOTE_USER value.
153 * <p>The first attribute with a value (and only a single value) will be used.
155 * @return a set of attribute IDs, or an empty set
157 virtual const std::set<std::string>& getRemoteUserAttributeIds() const=0;
160 * Clears any headers that may be used to hold attributes after export.
162 * @param request SP request to clear
164 virtual void clearAttributeHeaders(SPRequest& request) const=0;
167 * Returns the default SessionInitiator when automatically requesting a session.
169 * @return the default SessionInitiator, or NULL
171 virtual const SessionInitiator* getDefaultSessionInitiator() const=0;
174 * Returns a SessionInitiator with a particular ID when automatically requesting a session.
176 * @param id an identifier unique to the Application
177 * @return the designated SessionInitiator, or NULL
179 virtual const SessionInitiator* getSessionInitiatorById(const char* id) const=0;
182 * Returns the default AssertionConsumerService Handler
183 * for use in AuthnRequest messages.
185 * @return the default AssertionConsumerService, or NULL
187 virtual const Handler* getDefaultAssertionConsumerService() const=0;
190 * Returns an AssertionConsumerService Handler with a particular index
191 * for use in AuthnRequest messages.
193 * @param index an index unique to an application
194 * @return the designated AssertionConsumerService, or NULL
196 virtual const Handler* getAssertionConsumerServiceByIndex(unsigned short index) const=0;
199 * Returns one or more AssertionConsumerService Handlers that support
200 * a particular protocol binding.
202 * @param binding a protocol binding identifier
203 * @return a set of qualifying AssertionConsumerServices
205 virtual const std::vector<const Handler*>& getAssertionConsumerServicesByBinding(const XMLCh* binding) const=0;
208 * Returns the Handler associated with a particular path/location.
210 * @param path the PATH_INFO appended to the end of a base Handler location
211 * that invokes the Handler
212 * @return the mapped Handler, or NULL
214 virtual const Handler* getHandler(const char* path) const=0;
218 #endif /* __shibsp_app_h__ */