Add "sender" to SOAP APIs to avoid reuse of connections across apps.
[shibboleth/sp.git] / shibsp / Application.h
index 99797e2..118467f 100644 (file)
 #define __shibsp_app_h__
 
 #include <shibsp/util/PropertySet.h>
-#include <saml/saml2/metadata/MetadataProvider.h>
-#include <xmltooling/security/CredentialResolver.h>
-#include <xmltooling/security/TrustEngine.h>
+
+#include <set>
+#ifndef SHIBSP_LITE
+# include <saml/binding/MessageEncoder.h>
+# include <saml/saml2/metadata/MetadataProvider.h>
+# include <xmltooling/security/CredentialResolver.h>
+# include <xmltooling/security/TrustEngine.h>
+#endif
+#include <xmltooling/io/HTTPRequest.h>
 
 namespace shibsp {
     
+#ifndef SHIBSP_LITE
+    class SHIBSP_API AttributeExtractor;
+    class SHIBSP_API AttributeFilter;
     class SHIBSP_API AttributeResolver;
+#endif
     class SHIBSP_API Handler;
     class SHIBSP_API ServiceProvider;
+    class SHIBSP_API SessionInitiator;
+    class SHIBSP_API SPRequest;
 
     /**
      * Interface to a Shibboleth Application instance.
@@ -41,6 +53,9 @@ namespace shibsp {
      * of session management and policy.
      */
     class SHIBSP_API Application : public virtual PropertySet
+#ifndef SHIBSP_LITE
+        ,public virtual opensaml::MessageEncoder::ArtifactGenerator
+#endif
     {
         MAKE_NONCOPYABLE(Application);
     protected:
@@ -65,7 +80,7 @@ namespace shibsp {
         /**
          * Returns a unique hash for the Application.
          * 
-         * @return a value resulting from a hash of the Application's ID  
+         * @return a value resulting from a computation over the Application's configuration
          */
         virtual const char* getHash() const=0;
 
@@ -77,19 +92,36 @@ namespace shibsp {
          */
         virtual std::pair<std::string,const char*> getCookieNameProps(const char* prefix) const;
 
+#ifndef SHIBSP_LITE
         /**
          * Returns a MetadataProvider for use with this Application.
          * 
+         * @param required  true iff an exception should be thrown if no MetadataProvider is available
          * @return  a MetadataProvider instance, or NULL
          */
-        virtual opensaml::saml2md::MetadataProvider* getMetadataProvider() const=0;
+        virtual opensaml::saml2md::MetadataProvider* getMetadataProvider(bool required=true) const=0;
         
         /**
          * Returns a TrustEngine for use with this Application.
          * 
+         * @param required  true iff an exception should be thrown if no TrustEngine is available
          * @return  a TrustEngine instance, or NULL
          */
-        virtual xmltooling::TrustEngine* getTrustEngine() const=0;
+        virtual xmltooling::TrustEngine* getTrustEngine(bool required=true) const=0;
+
+        /**
+         * Returns an AttributeExtractor for use with this Application.
+         * 
+         * @return  an AttributeExtractor, or NULL
+         */
+        virtual AttributeExtractor* getAttributeExtractor() const=0;
+
+        /**
+         * Returns an AttributeFilter for use with this Application.
+         * 
+         * @return  an AttributeFilter, or NULL
+         */
+        virtual AttributeFilter* getAttributeFilter() const=0;
 
         /**
          * Returns an AttributeResolver for use with this Application.
@@ -114,22 +146,53 @@ namespace shibsp {
         virtual const PropertySet* getRelyingParty(const opensaml::saml2md::EntityDescriptor* provider) const=0;
 
         /**
-         * Returns the default SessionInitiator Handler when automatically
-         * requesting a session.
+         * Returns the set of audience values associated with this Application.
+         * 
+         * @return set of audience values associated with the Application
+         */
+        virtual const std::vector<const XMLCh*>& getAudiences() const=0;
+#endif
+
+        /**
+         * Returns the designated notification URL, or an empty string if no more locations are specified.
+         *
+         * @param request   requested URL to use to fill in missing pieces of notification URL
+         * @param front     true iff front channel notification is desired, false iff back channel is desired
+         * @param index     zero-based index of URL to return
+         * @return  the designated URL, or an empty string
+         */
+        virtual std::string getNotificationURL(const char* request, bool front, unsigned int index) const=0;
+
+        /**
+         * Returns a set of attribute IDs to use as a REMOTE_USER value.
+         * <p>The first attribute with a value (and only a single value) will be used.
+         *
+         * @return  a set of attribute IDs, or an empty set
+         */
+        virtual const std::set<std::string>& getRemoteUserAttributeIds() const=0;
+
+        /**
+         * Clears any headers that may be used to hold attributes after export.
+         *
+         * @param request   SP request to clear
+         */
+        virtual void clearAttributeHeaders(SPRequest& request) const=0;
+
+        /**
+         * Returns the default SessionInitiator when automatically requesting a session.
          * 
          * @return the default SessionInitiator, or NULL
          */
-        virtual const Handler* getDefaultSessionInitiator() const=0;
+        virtual const SessionInitiator* getDefaultSessionInitiator() const=0;
         
         /**
-         * Returns a SessionInitiator Handler with a particular ID when automatically
-         * requesting a session.
+         * Returns a SessionInitiator with a particular ID when automatically requesting a session.
          * 
          * @param id    an identifier unique to the Application
          * @return the designated SessionInitiator, or NULL
          */
-        virtual const Handler* getSessionInitiatorById(const char* id) const=0;
-        
+        virtual const SessionInitiator* getSessionInitiatorById(const char* id) const=0;
+
         /**
          * Returns the default AssertionConsumerService Handler
          * for use in AuthnRequest messages.
@@ -164,13 +227,6 @@ namespace shibsp {
          * @return the mapped Handler, or NULL 
          */
         virtual const Handler* getHandler(const char* path) const=0;
-
-        /**
-         * Returns the set of audience values associated with this Application.
-         * 
-         * @return set of audience values associated with the Application
-         */
-        virtual const std::vector<const XMLCh*>& getAudiences() const=0;
     };
 };