New -lite library and elimination of SAML libraries from modules.
[shibboleth/sp.git] / shibsp / impl / XMLServiceProvider.cpp
index 725970a..7a296fb 100644 (file)
 #include "SessionCache.h"\r
 #include "SPConfig.h"\r
 #include "SPRequest.h"\r
-#include "TransactionLog.h"\r
-#include "attribute/resolver/AttributeResolver.h"\r
-#include "handler/Handler.h"\r
+#include "handler/SessionInitiator.h"\r
 #include "remoting/ListenerService.h"\r
-#include "security/PKIXTrustEngine.h"\r
 #include "util/DOMPropertySet.h"\r
 #include "util/SPConstants.h"\r
 \r
-#include <sys/types.h>\r
-#include <sys/stat.h>\r
 #include <log4cpp/Category.hh>\r
 #include <log4cpp/PropertyConfigurator.hh>\r
-#include <saml/SAMLConfig.h>\r
-#include <saml/binding/ArtifactMap.h>\r
-#include <saml/saml1/core/Assertions.h>\r
-#include <saml/saml2/metadata/ChainingMetadataProvider.h>\r
+#include <xercesc/util/XMLUniDefs.hpp>\r
 #include <xmltooling/XMLToolingConfig.h>\r
-#include <xmltooling/security/ChainingTrustEngine.h>\r
 #include <xmltooling/util/NDC.h>\r
 #include <xmltooling/util/ReloadableXMLFile.h>\r
+#include <xmltooling/util/XMLHelper.h>\r
+\r
+#ifndef SHIBSP_LITE\r
+# include "TransactionLog.h"\r
+# include "attribute/filtering/AttributeFilter.h"\r
+# include "attribute/resolver/AttributeExtractor.h"\r
+# include "attribute/resolver/AttributeResolver.h"\r
+# include "security/PKIXTrustEngine.h"\r
+# include <saml/SAMLConfig.h>\r
+# include <saml/binding/ArtifactMap.h>\r
+# include <saml/saml1/core/Assertions.h>\r
+# include <saml/saml2/metadata/ChainingMetadataProvider.h>\r
+# include <xmltooling/security/ChainingTrustEngine.h>\r
 #include <xmltooling/util/ReplayCache.h>\r
-\r
-using namespace shibsp;\r
 using namespace opensaml::saml2;\r
 using namespace opensaml::saml2md;\r
 using namespace opensaml;\r
+#endif\r
+\r
+using namespace shibsp;\r
 using namespace xmltooling;\r
 using namespace log4cpp;\r
 using namespace std;\r
@@ -80,34 +85,45 @@ namespace {
         const char* getId() const {return getString("id").second;}\r
         const char* getHash() const {return m_hash.c_str();}\r
 \r
-        MetadataProvider* getMetadataProvider() const {\r
+#ifndef SHIBSP_LITE\r
+        MetadataProvider* getMetadataProvider(bool required=true) const {\r
+            if (required && !m_base && !m_metadata)\r
+                throw ConfigurationException("No MetadataProvider available.");\r
             return (!m_metadata && m_base) ? m_base->getMetadataProvider() : m_metadata;\r
         }\r
-        TrustEngine* getTrustEngine() const {\r
+        TrustEngine* getTrustEngine(bool required=true) const {\r
+            if (required && !m_base && !m_trust)\r
+                throw ConfigurationException("No TrustEngine available.");\r
             return (!m_trust && m_base) ? m_base->getTrustEngine() : m_trust;\r
         }\r
+        AttributeExtractor* getAttributeExtractor() const {\r
+            return (!m_attrExtractor && m_base) ? m_base->getAttributeExtractor() : m_attrExtractor;\r
+        }\r
+        AttributeFilter* getAttributeFilter() const {\r
+            return (!m_attrFilter && m_base) ? m_base->getAttributeFilter() : m_attrFilter;\r
+        }\r
         AttributeResolver* getAttributeResolver() const {\r
             return (!m_attrResolver && m_base) ? m_base->getAttributeResolver() : m_attrResolver;\r
         }\r
-        const set<string>* getAttributeIds() const {\r
-            return (m_attributeIds.empty() && m_base) ? m_base->getAttributeIds() : (m_attributeIds.empty() ? NULL : &m_attributeIds);\r
-        }\r
         CredentialResolver* getCredentialResolver() const {\r
             return (!m_credResolver && m_base) ? m_base->getCredentialResolver() : m_credResolver;\r
         }\r
         const PropertySet* getRelyingParty(const EntityDescriptor* provider) const;\r
+        const vector<const XMLCh*>& getAudiences() const {\r
+            return (m_audiences.empty() && m_base) ? m_base->getAudiences() : m_audiences;\r
+        }\r
+#endif\r
+        const set<string>& getRemoteUserAttributeIds() const {\r
+            return (m_attributeIds.empty() && m_base) ? m_base->getRemoteUserAttributeIds() : m_attributeIds;\r
+        }\r
 \r
-        const Handler* getDefaultSessionInitiator() const;\r
-        const Handler* getSessionInitiatorById(const char* id) const;\r
+        const SessionInitiator* getDefaultSessionInitiator() const;\r
+        const SessionInitiator* getSessionInitiatorById(const char* id) const;\r
         const Handler* getDefaultAssertionConsumerService() const;\r
         const Handler* getAssertionConsumerServiceByIndex(unsigned short index) const;\r
         const vector<const Handler*>& getAssertionConsumerServicesByBinding(const XMLCh* binding) const;\r
         const Handler* getHandler(const char* path) const;\r
 \r
-        const vector<const XMLCh*>& getAudiences() const {\r
-            return (m_audiences.empty() && m_base) ? m_base->getAudiences() : m_audiences;\r
-        }\r
-\r
         // Provides filter to exclude special config elements.\r
         short acceptNode(const DOMNode* node) const;\r
     \r
@@ -116,11 +132,15 @@ namespace {
         const ServiceProvider* m_sp;   // this is ok because its locking scope includes us\r
         const XMLApplication* m_base;\r
         string m_hash;\r
+#ifndef SHIBSP_LITE\r
         MetadataProvider* m_metadata;\r
         TrustEngine* m_trust;\r
+        AttributeExtractor* m_attrExtractor;\r
+        AttributeFilter* m_attrFilter;\r
         AttributeResolver* m_attrResolver;\r
         CredentialResolver* m_credResolver;\r
         vector<const XMLCh*> m_audiences;\r
+#endif\r
         set<string> m_attributeIds;\r
 \r
         // manage handler objects\r
@@ -143,12 +163,13 @@ namespace {
 #endif\r
         ACSBindingMap m_acsBindingMap;\r
 \r
-        // maps unique ID strings to session initiators\r
-        map<string,const Handler*> m_sessionInitMap;\r
-\r
         // pointer to default session initiator\r
-        const Handler* m_sessionInitDefault;\r
+        const SessionInitiator* m_sessionInitDefault;\r
+\r
+        // maps unique ID strings to session initiators\r
+        map<string,const SessionInitiator*> m_sessionInitMap;\r
 \r
+#ifndef SHIBSP_LITE\r
         // RelyingParty properties\r
         DOMPropertySet* m_partyDefault;\r
 #ifdef HAVE_GOOD_STL\r
@@ -156,6 +177,7 @@ namespace {
 #else\r
         map<const XMLCh*,PropertySet*> m_partyMap;\r
 #endif\r
+#endif\r
     };\r
 \r
     // Top-level configuration implementation\r
@@ -163,12 +185,14 @@ namespace {
     class SHIBSP_DLLLOCAL XMLConfigImpl : public DOMPropertySet, public DOMNodeFilter\r
     {\r
     public:\r
-        XMLConfigImpl(const DOMElement* e, bool first, const XMLConfig* outer);\r
+        XMLConfigImpl(const DOMElement* e, bool first, const XMLConfig* outer, Category& log);\r
         ~XMLConfigImpl();\r
         \r
         RequestMapper* m_requestMapper;\r
         map<string,Application*> m_appmap;\r
+#ifndef SHIBSP_LITE\r
         map< string,pair< PropertySet*,vector<const SecurityPolicyRule*> > > m_policyMap;\r
+#endif\r
         \r
         // Provides filter to exclude special config elements.\r
         short acceptNode(const DOMNode* node) const;\r
@@ -187,8 +211,12 @@ namespace {
     class SHIBSP_DLLLOCAL XMLConfig : public ServiceProvider, public ReloadableXMLFile\r
     {\r
     public:\r
-        XMLConfig(const DOMElement* e)\r
-            : ReloadableXMLFile(e), m_impl(NULL), m_listener(NULL), m_sessionCache(NULL), m_tranLog(NULL) {\r
+        XMLConfig(const DOMElement* e) : ReloadableXMLFile(e, Category::getInstance(SHIBSP_LOGCAT".Config")),\r
+            m_impl(NULL), m_listener(NULL), m_sessionCache(NULL)\r
+#ifndef SHIBSP_LITE\r
+            , m_tranLog(NULL)\r
+#endif\r
+        {\r
         }\r
         \r
         void init() {\r
@@ -199,10 +227,12 @@ namespace {
             delete m_impl;\r
             delete m_sessionCache;\r
             delete m_listener;\r
+#ifndef SHIBSP_LITE\r
             delete m_tranLog;\r
-            XMLToolingConfig::getConfig().setReplayCache(NULL);\r
             SAMLConfig::getConfig().setArtifactMap(NULL);\r
             for_each(m_storage.begin(), m_storage.end(), cleanup_pair<string,StorageService>());\r
+#endif\r
+            XMLToolingConfig::getConfig().setReplayCache(NULL);\r
         }\r
 \r
         // PropertySet\r
@@ -212,10 +242,11 @@ namespace {
         pair<bool,const XMLCh*> getXMLString(const char* name, const char* ns=NULL) const {return m_impl->getXMLString(name,ns);}\r
         pair<bool,unsigned int> getUnsignedInt(const char* name, const char* ns=NULL) const {return m_impl->getUnsignedInt(name,ns);}\r
         pair<bool,int> getInt(const char* name, const char* ns=NULL) const {return m_impl->getInt(name,ns);}\r
-        const PropertySet* getPropertySet(const char* name, const char* ns="urn:mace:shibboleth:sp:config:2.0") const {return m_impl->getPropertySet(name,ns);}\r
+        const PropertySet* getPropertySet(const char* name, const char* ns="urn:mace:shibboleth:2.0:native:sp:config") const {return m_impl->getPropertySet(name,ns);}\r
         const DOMElement* getElement() const {return m_impl->getElement();}\r
 \r
         // ServiceProvider\r
+#ifndef SHIBSP_LITE\r
         TransactionLog* getTransactionLog() const {\r
             if (m_tranLog)\r
                 return m_tranLog;\r
@@ -230,6 +261,7 @@ namespace {
             }\r
             return NULL;\r
         }\r
+#endif\r
 \r
         ListenerService* getListenerService(bool required=true) const {\r
             if (required && !m_listener)\r
@@ -254,6 +286,7 @@ namespace {
             return (i!=m_impl->m_appmap.end()) ? i->second : NULL;\r
         }\r
 \r
+#ifndef SHIBSP_LITE\r
         const PropertySet* getPolicySettings(const char* id) const {\r
             map<string,pair<PropertySet*,vector<const SecurityPolicyRule*> > >::const_iterator i = m_impl->m_policyMap.find(id);\r
             if (i!=m_impl->m_policyMap.end())\r
@@ -267,6 +300,7 @@ namespace {
                 return i->second.second;\r
             throw ConfigurationException("Security Policy ($1) not found, check <SecurityPolicies> element.", params(1,id));\r
         }\r
+#endif\r
 \r
     protected:\r
         pair<bool,DOMElement*> load();\r
@@ -276,8 +310,10 @@ namespace {
         XMLConfigImpl* m_impl;\r
         mutable ListenerService* m_listener;\r
         mutable SessionCache* m_sessionCache;\r
+#ifndef SHIBSP_LITE\r
         mutable TransactionLog* m_tranLog;\r
         mutable map<string,StorageService*> m_storage;\r
+#endif\r
     };\r
 \r
 #if defined (_MSC_VER)\r
@@ -287,9 +323,15 @@ namespace {
     static const XMLCh _Application[] =         UNICODE_LITERAL_11(A,p,p,l,i,c,a,t,i,o,n);\r
     static const XMLCh Applications[] =         UNICODE_LITERAL_12(A,p,p,l,i,c,a,t,i,o,n,s);\r
     static const XMLCh _ArtifactMap[] =         UNICODE_LITERAL_11(A,r,t,i,f,a,c,t,M,a,p);\r
+    static const XMLCh _AttributeExtractor[] =  UNICODE_LITERAL_18(A,t,t,r,i,b,u,t,e,E,x,t,r,a,c,t,o,r);\r
+    static const XMLCh _AttributeFilter[] =     UNICODE_LITERAL_15(A,t,t,r,i,b,u,t,e,F,i,l,t,e,r);\r
     static const XMLCh _AttributeResolver[] =   UNICODE_LITERAL_17(A,t,t,r,i,b,u,t,e,R,e,s,o,l,v,e,r);\r
+    static const XMLCh _AssertionConsumerService[] = UNICODE_LITERAL_24(A,s,s,e,r,t,i,o,n,C,o,n,s,u,m,e,r,S,e,r,v,i,c,e);\r
+    static const XMLCh _Audience[] =            UNICODE_LITERAL_8(A,u,d,i,e,n,c,e);\r
+    static const XMLCh Binding[] =              UNICODE_LITERAL_7(B,i,n,d,i,n,g);\r
     static const XMLCh _CredentialResolver[] =  UNICODE_LITERAL_18(C,r,e,d,e,n,t,i,a,l,R,e,s,o,l,v,e,r);\r
     static const XMLCh DefaultRelyingParty[] =  UNICODE_LITERAL_19(D,e,f,a,u,l,t,R,e,l,y,i,n,g,P,a,r,t,y);\r
+    static const XMLCh _Extensions[] =          UNICODE_LITERAL_10(E,x,t,e,n,s,i,o,n,s);\r
     static const XMLCh fatal[] =                UNICODE_LITERAL_5(f,a,t,a,l);\r
     static const XMLCh _Handler[] =             UNICODE_LITERAL_7(H,a,n,d,l,e,r);\r
     static const XMLCh _id[] =                  UNICODE_LITERAL_2(i,d);\r
@@ -298,6 +340,7 @@ namespace {
     static const XMLCh Library[] =              UNICODE_LITERAL_7(L,i,b,r,a,r,y);\r
     static const XMLCh Listener[] =             UNICODE_LITERAL_8(L,i,s,t,e,n,e,r);\r
     static const XMLCh logger[] =               UNICODE_LITERAL_6(l,o,g,g,e,r);\r
+    static const XMLCh _ManageNameIDService[] = UNICODE_LITERAL_19(M,a,n,a,g,e,N,a,m,e,I,D,S,e,r,v,i,c,e);\r
     static const XMLCh MemoryListener[] =       UNICODE_LITERAL_14(M,e,m,o,r,y,L,i,s,t,e,n,e,r);\r
     static const XMLCh _MetadataProvider[] =    UNICODE_LITERAL_16(M,e,t,a,d,a,t,a,P,r,o,v,i,d,e,r);\r
     static const XMLCh OutOfProcess[] =         UNICODE_LITERAL_12(O,u,t,O,f,P,r,o,c,e,s,s);\r
@@ -309,7 +352,8 @@ namespace {
     static const XMLCh Rule[] =                 UNICODE_LITERAL_4(R,u,l,e);\r
     static const XMLCh SecurityPolicies[] =     UNICODE_LITERAL_16(S,e,c,u,r,i,t,y,P,o,l,i,c,i,e,s);\r
     static const XMLCh _SessionCache[] =        UNICODE_LITERAL_12(S,e,s,s,i,o,n,C,a,c,h,e);\r
-    static const XMLCh SessionInitiator[] =     UNICODE_LITERAL_16(S,e,s,s,i,o,n,I,n,i,t,i,a,t,o,r);\r
+    static const XMLCh _SessionInitiator[] =    UNICODE_LITERAL_16(S,e,s,s,i,o,n,I,n,i,t,i,a,t,o,r);\r
+    static const XMLCh _SingleLogoutService[] = UNICODE_LITERAL_19(S,i,n,g,l,e,L,o,g,o,u,t,S,e,r,v,i,c,e);\r
     static const XMLCh _StorageService[] =      UNICODE_LITERAL_14(S,t,o,r,a,g,e,S,e,r,v,i,c,e);\r
     static const XMLCh TCPListener[] =          UNICODE_LITERAL_11(T,C,P,L,i,s,t,e,n,e,r);\r
     static const XMLCh _TrustEngine[] =         UNICODE_LITERAL_11(T,r,u,s,t,E,n,g,i,n,e);\r
@@ -338,8 +382,11 @@ XMLApplication::XMLApplication(
     const ServiceProvider* sp,\r
     const DOMElement* e,\r
     const XMLApplication* base\r
-    ) : m_sp(sp), m_base(base), m_metadata(NULL), m_trust(NULL), m_attrResolver(NULL), m_credResolver(NULL),\r
-        m_partyDefault(NULL), m_sessionInitDefault(NULL), m_acsDefault(NULL)\r
+    ) : m_sp(sp), m_base(base),\r
+#ifndef SHIBSP_LITE\r
+        m_metadata(NULL), m_trust(NULL), m_attrExtractor(NULL), m_attrFilter(NULL), m_attrResolver(NULL), m_credResolver(NULL), m_partyDefault(NULL),\r
+#endif\r
+        m_sessionInitDefault(NULL), m_acsDefault(NULL)\r
 {\r
 #ifdef _DEBUG\r
     xmltooling::NDC ndc("XMLApplication");\r
@@ -353,14 +400,17 @@ XMLApplication::XMLApplication(
             setParent(base);\r
 \r
         SPConfig& conf=SPConfig::getConfig();\r
+#ifndef SHIBSP_LITE\r
         SAMLConfig& samlConf=SAMLConfig::getConfig();\r
+#endif\r
         XMLToolingConfig& xmlConf=XMLToolingConfig::getConfig();\r
 \r
         m_hash=getId();\r
         m_hash+=getString("entityID").second;\r
-        m_hash=samlConf.hashSHA1(m_hash.c_str(), true);\r
+        // TODO: some kind of non-hash method\r
+        //m_hash=samlConf.hashSHA1(m_hash.c_str(), true);\r
 \r
-        pair<bool,const char*> attributes = getString("attributeIds");\r
+        pair<bool,const char*> attributes = getString("REMOTE_USER");\r
         if (attributes.first) {\r
             char* dup = strdup(attributes.second);\r
             char* pos;\r
@@ -389,8 +439,8 @@ XMLApplication::XMLApplication(
             try {\r
                 // A handler is based on the Binding property in conjunction with the element name.\r
                 // If it's an ACS or SI, also handle index/id mappings and defaulting.\r
-                if (XMLHelper::isNodeNamed(child,samlconstants::SAML20MD_NS,AssertionConsumerService::LOCAL_NAME)) {\r
-                    auto_ptr_char bindprop(child->getAttributeNS(NULL,EndpointType::BINDING_ATTRIB_NAME));\r
+                if (XMLString::equals(child->getLocalName(),_AssertionConsumerService)) {\r
+                    auto_ptr_char bindprop(child->getAttributeNS(NULL,Binding));\r
                     if (!bindprop.get() || !*(bindprop.get())) {\r
                         log.warn("md:AssertionConsumerService element has no Binding attribute, skipping it...");\r
                         child = XMLHelper::getNextSiblingElement(child);\r
@@ -417,31 +467,32 @@ XMLApplication::XMLApplication(
                             m_acsDefault=handler;\r
                     }\r
                 }\r
-                else if (XMLString::equals(child->getLocalName(),SessionInitiator)) {\r
+                else if (XMLString::equals(child->getLocalName(),_SessionInitiator)) {\r
                     auto_ptr_char type(child->getAttributeNS(NULL,_type));\r
                     if (!type.get() || !*(type.get())) {\r
                         log.warn("SessionInitiator element has no type attribute, skipping it...");\r
                         child = XMLHelper::getNextSiblingElement(child);\r
                         continue;\r
                     }\r
-                    handler=conf.SessionInitiatorManager.newPlugin(type.get(),make_pair(child, getId()));\r
+                    SessionInitiator* sihandler=conf.SessionInitiatorManager.newPlugin(type.get(),make_pair(child, getId()));\r
+                    handler=sihandler;\r
                     pair<bool,const char*> si_id=handler->getString("id");\r
                     if (si_id.first && si_id.second)\r
-                        m_sessionInitMap[si_id.second]=handler;\r
+                        m_sessionInitMap[si_id.second]=sihandler;\r
                     if (!hardSessionInit) {\r
                         pair<bool,bool> defprop=handler->getBool("isDefault");\r
                         if (defprop.first) {\r
                             if (defprop.second) {\r
                                 hardSessionInit=true;\r
-                                m_sessionInitDefault=handler;\r
+                                m_sessionInitDefault=sihandler;\r
                             }\r
                         }\r
                         else if (!m_sessionInitDefault)\r
-                            m_sessionInitDefault=handler;\r
+                            m_sessionInitDefault=sihandler;\r
                     }\r
                 }\r
-                else if (XMLHelper::isNodeNamed(child,samlconstants::SAML20MD_NS,SingleLogoutService::LOCAL_NAME)) {\r
-                    auto_ptr_char bindprop(child->getAttributeNS(NULL,EndpointType::BINDING_ATTRIB_NAME));\r
+                else if (XMLString::equals(child->getLocalName(),_SingleLogoutService)) {\r
+                    auto_ptr_char bindprop(child->getAttributeNS(NULL,Binding));\r
                     if (!bindprop.get() || !*(bindprop.get())) {\r
                         log.warn("md:SingleLogoutService element has no Binding attribute, skipping it...");\r
                         child = XMLHelper::getNextSiblingElement(child);\r
@@ -449,8 +500,8 @@ XMLApplication::XMLApplication(
                     }\r
                     handler=conf.SingleLogoutServiceManager.newPlugin(bindprop.get(),make_pair(child, getId()));\r
                 }\r
-                else if (XMLHelper::isNodeNamed(child,samlconstants::SAML20MD_NS,ManageNameIDService::LOCAL_NAME)) {\r
-                    auto_ptr_char bindprop(child->getAttributeNS(NULL,EndpointType::BINDING_ATTRIB_NAME));\r
+                else if (XMLString::equals(child->getLocalName(),_ManageNameIDService)) {\r
+                    auto_ptr_char bindprop(child->getAttributeNS(NULL,Binding));\r
                     if (!bindprop.get() || !*(bindprop.get())) {\r
                         log.warn("md:ManageNameIDService element has no Binding attribute, skipping it...");\r
                         child = XMLHelper::getNextSiblingElement(child);\r
@@ -486,6 +537,7 @@ XMLApplication::XMLApplication(
             child = XMLHelper::getNextSiblingElement(child);\r
         }\r
 \r
+#ifndef SHIBSP_LITE\r
         DOMNodeList* nlist=e->getElementsByTagNameNS(samlconstants::SAML20_NS,Audience::LOCAL_NAME);\r
         for (XMLSize_t i=0; nlist && i<nlist->getLength(); i++)\r
             if (nlist->item(i)->getParentNode()->isSameNode(e) && nlist->item(i)->hasChildNodes())\r
@@ -525,6 +577,30 @@ XMLApplication::XMLApplication(
         }\r
 \r
         if (conf.isEnabled(SPConfig::AttributeResolution)) {\r
+            child = XMLHelper::getFirstChildElement(e,_AttributeExtractor);\r
+            if (child) {\r
+                auto_ptr_char type(child->getAttributeNS(NULL,_type));\r
+                log.info("building AttributeExtractor of type %s...",type.get());\r
+                try {\r
+                    m_attrExtractor = conf.AttributeExtractorManager.newPlugin(type.get(),child);\r
+                }\r
+                catch (exception& ex) {\r
+                    log.crit("error building AttributeExtractor: %s", ex.what());\r
+                }\r
+            }\r
+\r
+            child = XMLHelper::getFirstChildElement(e,_AttributeFilter);\r
+            if (child) {\r
+                auto_ptr_char type(child->getAttributeNS(NULL,_type));\r
+                log.info("building AttributeFilter of type %s...",type.get());\r
+                try {\r
+                    m_attrFilter = conf.AttributeFilterManager.newPlugin(type.get(),child);\r
+                }\r
+                catch (exception& ex) {\r
+                    log.crit("error building AttributeFilter: %s", ex.what());\r
+                }\r
+            }\r
+\r
             child = XMLHelper::getFirstChildElement(e,_AttributeResolver);\r
             if (child) {\r
                 auto_ptr_char type(child->getAttributeNS(NULL,_type));\r
@@ -552,7 +628,6 @@ XMLApplication::XMLApplication(
             }\r
         }\r
 \r
-\r
         // Finally, load relying parties.\r
         child = XMLHelper::getFirstChildElement(e,DefaultRelyingParty);\r
         if (child) {\r
@@ -566,11 +641,7 @@ XMLApplication::XMLApplication(
                 child = XMLHelper::getNextSiblingElement(child,RelyingParty);\r
             }\r
         }\r
-        \r
-        if (conf.isEnabled(SPConfig::OutOfProcess)) {\r
-            // Really finally, build local browser profile and binding objects.\r
-            // TODO: may need some bits here...\r
-        }\r
+#endif        \r
     }\r
     catch (exception&) {\r
         cleanup();\r
@@ -586,42 +657,47 @@ XMLApplication::XMLApplication(
 \r
 void XMLApplication::cleanup()\r
 {\r
+    for_each(m_handlers.begin(),m_handlers.end(),xmltooling::cleanup<Handler>());\r
+#ifndef SHIBSP_LITE\r
     delete m_partyDefault;\r
 #ifdef HAVE_GOOD_STL\r
     for_each(m_partyMap.begin(),m_partyMap.end(),cleanup_pair<xstring,PropertySet>());\r
 #else\r
     for_each(m_partyMap.begin(),m_partyMap.end(),cleanup_pair<const XMLCh*,PropertySet>());\r
 #endif\r
-    for_each(m_handlers.begin(),m_handlers.end(),xmltooling::cleanup<Handler>());\r
     delete m_credResolver;\r
     delete m_attrResolver;\r
+    delete m_attrFilter;\r
+    delete m_attrExtractor;\r
     delete m_trust;\r
     delete m_metadata;\r
+#endif\r
 }\r
 \r
 short XMLApplication::acceptNode(const DOMNode* node) const\r
 {\r
-    if (XMLHelper::isNodeNamed(node,samlconstants::SAML20_NS,saml2::Attribute::LOCAL_NAME))\r
-        return FILTER_REJECT;\r
-    else if (XMLHelper::isNodeNamed(node,samlconstants::SAML20_NS,Audience::LOCAL_NAME))\r
-        return FILTER_REJECT;\r
     const XMLCh* name=node->getLocalName();\r
     if (XMLString::equals(name,_Application) ||\r
-        XMLString::equals(name,AssertionConsumerService::LOCAL_NAME) ||\r
-        XMLString::equals(name,SingleLogoutService::LOCAL_NAME) ||\r
-        XMLString::equals(name,ManageNameIDService::LOCAL_NAME) ||\r
-        XMLString::equals(name,SessionInitiator) ||\r
+        XMLString::equals(name,_Audience) ||\r
+        XMLString::equals(name,_AssertionConsumerService) ||\r
+        XMLString::equals(name,_SingleLogoutService) ||\r
+        XMLString::equals(name,_ManageNameIDService) ||\r
+        XMLString::equals(name,_SessionInitiator) ||\r
         XMLString::equals(name,DefaultRelyingParty) ||\r
         XMLString::equals(name,RelyingParty) ||\r
         XMLString::equals(name,_MetadataProvider) ||\r
         XMLString::equals(name,_TrustEngine) ||\r
         XMLString::equals(name,_CredentialResolver) ||\r
+        XMLString::equals(name,_AttributeFilter) ||\r
+        XMLString::equals(name,_AttributeExtractor) ||\r
         XMLString::equals(name,_AttributeResolver))\r
         return FILTER_REJECT;\r
 \r
     return FILTER_ACCEPT;\r
 }\r
 \r
+#ifndef SHIBSP_LITE\r
+\r
 const PropertySet* XMLApplication::getRelyingParty(const EntityDescriptor* provider) const\r
 {\r
     if (!m_partyDefault && m_base)\r
@@ -658,15 +734,17 @@ const PropertySet* XMLApplication::getRelyingParty(const EntityDescriptor* provi
     return m_partyDefault;\r
 }\r
 \r
-const Handler* XMLApplication::getDefaultSessionInitiator() const\r
+#endif\r
+\r
+const SessionInitiator* XMLApplication::getDefaultSessionInitiator() const\r
 {\r
     if (m_sessionInitDefault) return m_sessionInitDefault;\r
     return m_base ? m_base->getDefaultSessionInitiator() : NULL;\r
 }\r
 \r
-const Handler* XMLApplication::getSessionInitiatorById(const char* id) const\r
+const SessionInitiator* XMLApplication::getSessionInitiatorById(const char* id) const\r
 {\r
-    map<string,const Handler*>::const_iterator i=m_sessionInitMap.find(id);\r
+    map<string,const SessionInitiator*>::const_iterator i=m_sessionInitMap.find(id);\r
     if (i!=m_sessionInitMap.end()) return i->second;\r
     return m_base ? m_base->getSessionInitiatorById(id) : NULL;\r
 }\r
@@ -713,7 +791,7 @@ short XMLConfigImpl::acceptNode(const DOMNode* node) const
     const XMLCh* name=node->getLocalName();\r
     if (XMLString::equals(name,Applications) ||\r
         XMLString::equals(name,_ArtifactMap) ||\r
-        XMLString::equals(name,Extensions::LOCAL_NAME) ||\r
+        XMLString::equals(name,_Extensions) ||\r
         XMLString::equals(name,Implementation) ||\r
         XMLString::equals(name,Listener) ||\r
         XMLString::equals(name,MemoryListener) ||\r
@@ -731,7 +809,7 @@ short XMLConfigImpl::acceptNode(const DOMNode* node) const
 \r
 void XMLConfigImpl::doExtensions(const DOMElement* e, const char* label, Category& log)\r
 {\r
-    const DOMElement* exts=XMLHelper::getFirstChildElement(e,Extensions::LOCAL_NAME);\r
+    const DOMElement* exts=XMLHelper::getFirstChildElement(e,_Extensions);\r
     if (exts) {\r
         exts=XMLHelper::getFirstChildElement(exts,Library);\r
         while (exts) {\r
@@ -757,16 +835,18 @@ void XMLConfigImpl::doExtensions(const DOMElement* e, const char* label, Categor
     }\r
 }\r
 \r
-XMLConfigImpl::XMLConfigImpl(const DOMElement* e, bool first, const XMLConfig* outer) : m_requestMapper(NULL), m_outer(outer), m_document(NULL)\r
+XMLConfigImpl::XMLConfigImpl(const DOMElement* e, bool first, const XMLConfig* outer, Category& log)\r
+    : m_requestMapper(NULL), m_outer(outer), m_document(NULL)\r
 {\r
 #ifdef _DEBUG\r
     xmltooling::NDC ndc("XMLConfigImpl");\r
 #endif\r
-    Category& log=Category::getInstance(SHIBSP_LOGCAT".Config");\r
 \r
     try {\r
         SPConfig& conf=SPConfig::getConfig();\r
+#ifndef SHIBSP_LITE\r
         SAMLConfig& samlConf=SAMLConfig::getConfig();\r
+#endif\r
         XMLToolingConfig& xmlConf=XMLToolingConfig::getConfig();\r
         const DOMElement* SHAR=XMLHelper::getFirstChildElement(e,OutOfProcess);\r
         const DOMElement* SHIRE=XMLHelper::getFirstChildElement(e,InProcess);\r
@@ -786,8 +866,10 @@ XMLConfigImpl::XMLConfigImpl(const DOMElement* e, bool first, const XMLConfig* o
                 XMLToolingConfig::getConfig().log_config(logpath.get());\r
             }\r
             \r
+#ifndef SHIBSP_LITE\r
             if (first)\r
                 m_outer->m_tranLog = new TransactionLog();\r
+#endif\r
         }\r
         \r
         // First load any property sets.\r
@@ -846,6 +928,7 @@ XMLConfigImpl::XMLConfigImpl(const DOMElement* e, bool first, const XMLConfig* o
 \r
             if (conf.isEnabled(SPConfig::Caching)) {\r
                 if (conf.isEnabled(SPConfig::OutOfProcess)) {\r
+#ifndef SHIBSP_LITE\r
                     // First build any StorageServices.\r
                     string inmemID;\r
                     child=XMLHelper::getFirstChildElement(SHAR,_StorageService);\r
@@ -921,6 +1004,7 @@ XMLConfigImpl::XMLConfigImpl(const DOMElement* e, bool first, const XMLConfig* o
                         log.info("building in-memory ArtifactMap...");\r
                         samlConf.setArtifactMap(new ArtifactMap(child));\r
                     }\r
+#endif\r
                 }\r
                 else {\r
                     child=XMLHelper::getFirstChildElement(SHIRE,_SessionCache);\r
@@ -947,6 +1031,7 @@ XMLConfigImpl::XMLConfigImpl(const DOMElement* e, bool first, const XMLConfig* o
             }\r
         }\r
         \r
+#ifndef SHIBSP_LITE\r
         // Load security policies.\r
         child = XMLHelper::getLastChildElement(e,SecurityPolicies);\r
         if (child) {\r
@@ -973,6 +1058,7 @@ XMLConfigImpl::XMLConfigImpl(const DOMElement* e, bool first, const XMLConfig* o
                 child = XMLHelper::getNextSiblingElement(child,Policy);\r
             }\r
         }\r
+#endif\r
 \r
         // Load the default application. This actually has a fixed ID of "default". ;-)\r
         child=XMLHelper::getLastChildElement(e,Applications);\r
@@ -1010,10 +1096,12 @@ XMLConfigImpl::XMLConfigImpl(const DOMElement* e, bool first, const XMLConfig* o
 XMLConfigImpl::~XMLConfigImpl()\r
 {\r
     for_each(m_appmap.begin(),m_appmap.end(),cleanup_pair<string,Application>());\r
+#ifndef SHIBSP_LITE\r
     for (map< string,pair<PropertySet*,vector<const SecurityPolicyRule*> > >::iterator i=m_policyMap.begin(); i!=m_policyMap.end(); ++i) {\r
         delete i->second.first;\r
         for_each(i->second.second.begin(), i->second.second.end(), xmltooling::cleanup<SecurityPolicyRule>());\r
     }\r
+#endif\r
     delete m_requestMapper;\r
     if (m_document)\r
         m_document->release();\r
@@ -1027,7 +1115,7 @@ pair<bool,DOMElement*> XMLConfig::load()
     // If we own it, wrap it.\r
     XercesJanitor<DOMDocument> docjanitor(raw.first ? raw.second->getOwnerDocument() : NULL);\r
 \r
-    XMLConfigImpl* impl = new XMLConfigImpl(raw.second,(m_impl==NULL),this);\r
+    XMLConfigImpl* impl = new XMLConfigImpl(raw.second,(m_impl==NULL),this,m_log);\r
     \r
     // If we held the document, transfer it to the impl. If we didn't, it's a no-op.\r
     impl->setDocument(docjanitor.release());\r