Old config class ported, all config files now loading with new parser.
authorcantor <cantor@cb58f699-b61c-0410-a6fe-9272a202ed29>
Sat, 6 Jan 2007 04:57:15 +0000 (04:57 +0000)
committercantor <cantor@cb58f699-b61c-0410-a6fe-9272a202ed29>
Sat, 6 Jan 2007 04:57:15 +0000 (04:57 +0000)
git-svn-id: https://svn.middleware.georgetown.edu/cpp-sp/trunk@2122 cb58f699-b61c-0410-a6fe-9272a202ed29

28 files changed:
.cdtproject
apache/mod_apache.cpp
isapi_shib/isapi_shib.cpp
nsapi_shib/nsapi_shib.cpp
odbc_ccache/odbc-ccache.cpp
shib-mysql-ccache/shib-mysql-ccache.cpp
shib-target/Makefile.am
shib-target/XML.cpp [deleted file]
shib-target/XMLRequestMapper.cpp
shib-target/shib-ccache.cpp
shib-target/shib-config.cpp
shib-target/shib-handlers.cpp
shib-target/shib-ini.cpp
shib-target/shib-target.cpp
shib-target/shib-target.h
shib-target/shibtarget.vcproj
shib/Makefile.am
shib/ReloadableXMLFile.cpp [deleted file]
shib/ShibConfig.cpp
shib/shib.h
shib/shib.vcproj
shibsp/SPConstants.cpp
shibsp/SPConstants.h
test/posttest.cpp
test/shibtest.cpp
xmlproviders/XMLAAP.cpp
xmlproviders/XMLAccessControl.cpp
xmlproviders/XMLProviders.cpp

index 901182e..10e639b 100644 (file)
@@ -9,6 +9,7 @@
     <item id="org.eclipse.cdt.core.pathentry">
 <pathentry kind="src" path="shibsp"/>
 <pathentry kind="out" path=""/>
+<pathentry kind="src" path="odbc-store"/>
 </item>
 </data>
 </cdtproject>
index cb3b46c..8875906 100644 (file)
@@ -39,6 +39,7 @@
 #include <shib/shib.h>
 #include <shib-target/shib-target.h>
 #include <xercesc/util/regx/RegularExpression.hpp>
+#include <xmltooling/util/Threads.h>
 
 #ifdef WIN32
 # include <winsock.h>
@@ -572,7 +573,7 @@ saml::IPlugIn* ApacheRequestMapFactory(const DOMElement* e)
 
 ApacheRequestMapper::ApacheRequestMapper(const DOMElement* e) : m_mapper(NULL), m_staKey(NULL), m_propsKey(NULL), m_htaccess(NULL)
 {
-    saml::IPlugIn* p=saml::SAMLConfig::getConfig().getPlugMgr().newPlugin(shibtarget::XML::XMLRequestMapType,e);
+    saml::IPlugIn* p=saml::SAMLConfig::getConfig().getPlugMgr().newPlugin(XML_REQUESTMAP_PROVIDER,e);
     m_mapper=dynamic_cast<IRequestMapper*>(p);
     if (!m_mapper) {
         delete p;
@@ -1048,10 +1049,10 @@ extern "C" void shib_child_init(apr_pool_t* p, server_rec* s)
             ap_log_error(APLOG_MARK,APLOG_CRIT|APLOG_NOERRNO,SH_AP_R(s),"shib_child_init() failed to initialize libraries");
             exit(1);
         }
-        saml::SAMLConfig::getConfig().getPlugMgr().regFactory(shibtarget::XML::htAccessControlType,&htAccessFactory);
-        saml::SAMLConfig::getConfig().getPlugMgr().regFactory(shibtarget::XML::NativeRequestMapType,&ApacheRequestMapFactory);
+        saml::SAMLConfig::getConfig().getPlugMgr().regFactory(HTACCESS_ACCESSCONTROL,&htAccessFactory);
+        saml::SAMLConfig::getConfig().getPlugMgr().regFactory(NATIVE_REQUESTMAP_PROVIDER,&ApacheRequestMapFactory);
         // We hijack the legacy type so that 1.2 config files will load this plugin
-        saml::SAMLConfig::getConfig().getPlugMgr().regFactory(shibtarget::XML::LegacyRequestMapType,&ApacheRequestMapFactory);
+        saml::SAMLConfig::getConfig().getPlugMgr().regFactory(LEGACY_REQUESTMAP_PROVIDER,&ApacheRequestMapFactory);
         
         if (!g_Config->load(g_szSHIBConfig)) {
             ap_log_error(APLOG_MARK,APLOG_CRIT|APLOG_NOERRNO,SH_AP_R(s),"shib_child_init() failed to load configuration");
@@ -1059,7 +1060,7 @@ extern "C" void shib_child_init(apr_pool_t* p, server_rec* s)
         }
 
         IConfig* conf=g_Config->getINI();
-        saml::Locker locker(conf);
+        xmltooling::Locker locker(conf);
         const PropertySet* props=conf->getPropertySet("Local");
         if (props) {
             pair<bool,const char*> unsetValue=props->getString("unsetHeaderValue");
index 0636687..2b9a60e 100644 (file)
@@ -57,11 +57,8 @@ namespace {
     { chLatin_I, chLatin_m, chLatin_p, chLatin_l, chLatin_e, chLatin_m, chLatin_e, chLatin_n, chLatin_t, chLatin_a, chLatin_t, chLatin_i, chLatin_o, chLatin_n, chNull };
     static const XMLCh ISAPI[] = { chLatin_I, chLatin_S, chLatin_A, chLatin_P, chLatin_I, chNull };
     static const XMLCh Alias[] = { chLatin_A, chLatin_l, chLatin_i, chLatin_a, chLatin_s, chNull };
-    static const XMLCh normalizeRequest[] =
-    { chLatin_n, chLatin_o, chLatin_r, chLatin_m, chLatin_a, chLatin_l, chLatin_i, chLatin_z, chLatin_e,
-      chLatin_R, chLatin_e, chLatin_q, chLatin_u, chLatin_e, chLatin_s, chLatin_t, chNull
-    };
-    static const XMLCh Site[] = { chLatin_S, chLatin_i, chLatin_t, chLatin_e, chNull };
+    static const XMLCh normalizeRequest[] = UNICODE_LITERAL_16(n,o,r,m,a,l,i,z,e,R,e,q,u,e,s,t);
+    static const XMLCh Site[] =             UNICODE_LITERAL_4(S,i,t,e);
 
     struct site_t {
         site_t(const DOMElement* e)
@@ -74,12 +71,13 @@ namespace {
             if (s.get()) m_scheme=s.get();
             if (p.get()) m_port=p.get();
             if (p2.get()) m_sslport=p2.get();
-            DOMNodeList* nlist=e->getElementsByTagNameNS(shibtarget::XML::SHIBTARGET_NS,Alias);
-            for (unsigned int i=0; nlist && i<nlist->getLength(); i++) {
-                if (nlist->item(i)->hasChildNodes()) {
-                    auto_ptr_char alias(nlist->item(i)->getFirstChild()->getNodeValue());
+            e = XMLHelper::getFirstChildElement(e, Alias);
+            while (e) {
+                if (e->hasChildNodes()) {
+                    auto_ptr_char alias(e->getFirstChild()->getNodeValue());
                     m_aliases.insert(alias.get());
                 }
+                e = XMLHelper::getNextSiblingElement(e, Alias);
             }
         }
         string m_scheme,m_port,m_sslport,m_name;
@@ -180,21 +178,19 @@ extern "C" BOOL WINAPI GetFilterVersion(PHTTP_FILTER_VERSION pVer)
         
         // Access the implementation-specifics for site mappings.
         IConfig* conf=g_Config->getINI();
-        saml::Locker locker(conf);
+        xmltooling::Locker locker(conf);
         const PropertySet* props=conf->getPropertySet("Local");
         if (props) {
-            const DOMElement* impl=saml::XML::getFirstChildElement(
-                props->getElement(),shibtarget::XML::SHIBTARGET_NS,Implementation
-                );
-            if (impl && (impl=saml::XML::getFirstChildElement(impl,shibtarget::XML::SHIBTARGET_NS,ISAPI))) {
+            const DOMElement* impl=XMLHelper::getFirstChildElement(props->getElement(),Implementation);
+            if (impl && (impl=XMLHelper::getFirstChildElement(impl,ISAPI))) {
                 const XMLCh* flag=impl->getAttributeNS(NULL,normalizeRequest);
                 g_bNormalizeRequest=(!flag || !*flag || *flag==chDigit_1 || *flag==chLatin_t);
-                impl=saml::XML::getFirstChildElement(impl,shibtarget::XML::SHIBTARGET_NS,Site);
+                impl=XMLHelper::getFirstChildElement(impl,Site);
                 while (impl) {
                     auto_ptr_char id(impl->getAttributeNS(NULL,id));
                     if (id.get())
                         g_Sites.insert(pair<string,site_t>(id.get(),site_t(impl)));
-                    impl=saml::XML::getNextSiblingElement(impl,shibtarget::XML::SHIBTARGET_NS,Site);
+                    impl=XMLHelper::getNextSiblingElement(impl,Site);
                 }
             }
         }
index a7c433c..9b44df1 100644 (file)
@@ -32,6 +32,7 @@
 #endif
 
 #include <shibsp/SPConfig.h>
+#include <xmltooling/util/Threads.h>
 
 // SAML Runtime
 #include <saml/saml.h>
@@ -140,9 +141,9 @@ extern "C" NSAPI_PUBLIC int nsapi_shib_init(pblock* pb, Session* sn, Request* rq
             return REQ_ABORTED;
         }
 
-        SAMLConfig::getConfig().getPlugMgr().regFactory(shibtarget::XML::NativeRequestMapType,&SunRequestMapFactory);
+        SAMLConfig::getConfig().getPlugMgr().regFactory(NATIVE_REQUESTMAP_PROVIDER,&SunRequestMapFactory);
         // We hijack the legacy type so that 1.2 config files will load this plugin
-        SAMLConfig::getConfig().getPlugMgr().regFactory(shibtarget::XML::LegacyRequestMapType,&SunRequestMapFactory);
+        SAMLConfig::getConfig().getPlugMgr().regFactory(LEGACY_REQUESTMAP_PROVIDER,&SunRequestMapFactory);
 
         if (!g_Config->load(config)) {
             g_Config=NULL;
@@ -423,7 +424,7 @@ IPlugIn* SunRequestMapFactory(const DOMElement* e)
 
 SunRequestMapper::SunRequestMapper(const DOMElement* e) : m_mapper(NULL), m_stKey(NULL), m_propsKey(NULL)
 {
-    IPlugIn* p=SAMLConfig::getConfig().getPlugMgr().newPlugin(shibtarget::XML::XMLRequestMapType,e);
+    IPlugIn* p=SAMLConfig::getConfig().getPlugMgr().newPlugin(XML_REQUESTMAP_PROVIDER,e);
     m_mapper=dynamic_cast<IRequestMapper*>(p);
     if (!m_mapper) {
         delete p;
index 1dc7b99..6b9fe4c 100644 (file)
@@ -42,6 +42,7 @@
 #include <shibsp/exceptions.h>
 #include <log4cpp/Category.hh>
 #include <xmltooling/util/NDC.h>
+#include <xmltooling/util/Threads.h>
 
 #include <ctime>
 #include <algorithm>
@@ -162,7 +163,7 @@ ODBCBase::ODBCBase(const DOMElement* e) : m_root(e), m_bInitializedODBC(false)
     }
 
     // Grab connection string from the configuration.
-    e=saml::XML::getFirstChildElement(e,shibtarget::XML::SHIBTARGET_NS,ConnectionString);
+    e=XMLHelper::getFirstChildElement(e,ConnectionString);
     if (!e || !e->hasChildNodes()) {
         if (!p_connstring) {
             this->~ODBCBase();
@@ -338,7 +339,7 @@ ODBCCCache::ODBCCCache(const DOMElement* e) : ODBCBase(e), m_storeAttributes(fal
     log = &(Category::getInstance("shibtarget.SessionCache.ODBC"));
 
     m_cache = dynamic_cast<ISessionCache*>(
-        SAMLConfig::getConfig().getPlugMgr().newPlugin(shibtarget::XML::MemorySessionCacheType, m_root)
+        SAMLConfig::getConfig().getPlugMgr().newPlugin(MEMORY_SESSIONCACHE, m_root)
     );
     if (!m_cache->setBackingStore(this)) {
         delete m_cache;
@@ -929,13 +930,13 @@ IPlugIn* new_odbc_replay(const DOMElement* e)
 extern "C" int SHIBODBC_EXPORTS saml_extension_init(void*)
 {
     // register this ccache type
-    SAMLConfig::getConfig().getPlugMgr().regFactory(shibtarget::XML::ODBCReplayCacheType, &new_odbc_replay);
-    SAMLConfig::getConfig().getPlugMgr().regFactory(shibtarget::XML::ODBCSessionCacheType, &new_odbc_ccache);
+    SAMLConfig::getConfig().getPlugMgr().regFactory(ODBC_REPLAYCACHE, &new_odbc_replay);
+    SAMLConfig::getConfig().getPlugMgr().regFactory(ODBC_SESSIONCACHE, &new_odbc_ccache);
     return 0;
 }
 
 extern "C" void SHIBODBC_EXPORTS saml_extension_term()
 {
-    SAMLConfig::getConfig().getPlugMgr().unregFactory(shibtarget::XML::ODBCSessionCacheType);
-    SAMLConfig::getConfig().getPlugMgr().unregFactory(shibtarget::XML::ODBCReplayCacheType);
+    SAMLConfig::getConfig().getPlugMgr().unregFactory(ODBC_SESSIONCACHE);
+    SAMLConfig::getConfig().getPlugMgr().unregFactory(ODBC_REPLAYCACHE);
 }
index e8f8321..ff5aec8 100644 (file)
 
 #include <shib-target/shib-target.h>
 
-#include <xmltooling/util/NDC.h>
 #include <log4cpp/Category.hh>
+#include <xmltooling/util/NDC.h>
+#include <xmltooling/util/Threads.h>
+#include <xmltooling/util/XMLHelper.h>
+using xmltooling::XMLHelper;
 
 #include <sstream>
 
@@ -354,12 +357,12 @@ static void mysqlInit(const DOMElement* e, Category& log)
     arg_array.push_back("shibboleth");
 
     // grab any MySQL parameters from the config file
-    e=saml::XML::getFirstChildElement(e,shibtarget::XML::SHIBTARGET_NS,Argument);
+    e=XMLHelper::getFirstChildElement(e,Argument);
     while (e) {
         auto_ptr_char arg(e->getFirstChild()->getNodeValue());
         if (arg.get())
             arg_array.push_back(arg.get());
-        e=saml::XML::getNextSiblingElement(e,shibtarget::XML::SHIBTARGET_NS,Argument);
+        e=XMLHelper::getNextSiblingElement(e,Argument);
     }
 
     // Compute the argument array
@@ -444,7 +447,7 @@ ShibMySQLCCache::ShibMySQLCCache(const DOMElement* e) : MySQLBase(e), m_storeAtt
 #endif
 
     m_cache = dynamic_cast<ISessionCache*>(
-        SAMLConfig::getConfig().getPlugMgr().newPlugin(shibtarget::XML::MemorySessionCacheType, e)
+        SAMLConfig::getConfig().getPlugMgr().newPlugin(MEMORY_SESSIONCACHE, e)
     );
     if (!m_cache->setBackingStore(this)) {
         delete m_cache;
@@ -944,8 +947,8 @@ IPlugIn* new_mysql_replay(const DOMElement* e)
 extern "C" int SHIBMYSQL_EXPORTS saml_extension_init(void*)
 {
     // register this ccache type
-    SAMLConfig::getConfig().getPlugMgr().regFactory(shibtarget::XML::MySQLReplayCacheType, &new_mysql_replay);
-    SAMLConfig::getConfig().getPlugMgr().regFactory(shibtarget::XML::MySQLSessionCacheType, &new_mysql_ccache);
+    SAMLConfig::getConfig().getPlugMgr().regFactory(MYSQL_REPLAYCACHE, &new_mysql_replay);
+    SAMLConfig::getConfig().getPlugMgr().regFactory(MYSQL_SESSIONCACHE, &new_mysql_ccache);
     return 0;
 }
 
@@ -954,6 +957,6 @@ extern "C" void SHIBMYSQL_EXPORTS saml_extension_term()
     // Shutdown MySQL
     if (g_MySQLInitialized)
         mysql_server_end();
-    SAMLConfig::getConfig().getPlugMgr().unregFactory(shibtarget::XML::MySQLReplayCacheType);
-    SAMLConfig::getConfig().getPlugMgr().unregFactory(shibtarget::XML::MySQLSessionCacheType);
+    SAMLConfig::getConfig().getPlugMgr().unregFactory(MYSQL_REPLAYCACHE);
+    SAMLConfig::getConfig().getPlugMgr().unregFactory(MYSQL_SESSIONCACHE);
 }
index 022e5f9..4da6550 100644 (file)
@@ -19,7 +19,6 @@ libshib_target_la_SOURCES = \
        shib-handlers.cpp \
        shib-ini.cpp \
        shib-target.cpp \
-       XML.cpp \
        XMLRequestMapper.cpp
 
 # this is different from the project version
diff --git a/shib-target/XML.cpp b/shib-target/XML.cpp
deleted file mode 100644 (file)
index 0c3ae8f..0000000
+++ /dev/null
@@ -1,273 +0,0 @@
-/*
- *  Copyright 2001-2005 Internet2
- * 
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/* XML.cpp - XML constants
-
-   Scott Cantor
-   6/4/02
-
-   $History:$
-*/
-
-#include "internal.h"
-
-using namespace shibtarget;
-
-const char XML::MemorySessionCacheType[] =  "edu.internet2.middleware.shibboleth.sp.provider.MemorySessionCacheProvider";
-const char XML::MySQLSessionCacheType[] =   "edu.internet2.middleware.shibboleth.sp.provider.MySQLSessionCacheProvider";
-const char XML::ODBCSessionCacheType[] =    "edu.internet2.middleware.shibboleth.sp.provider.ODBCSessionCacheProvider";
-
-const char XML::MySQLReplayCacheType[] =    "edu.internet2.middleware.shibboleth.sp.provider.MySQLReplayCacheProvider";
-const char XML::ODBCReplayCacheType[] =     "edu.internet2.middleware.shibboleth.sp.provider.ODBCReplayCacheProvider";
-
-const char XML::XMLRequestMapType[] =       "edu.internet2.middleware.shibboleth.sp.provider.XMLRequestMapProvider";
-const char XML::NativeRequestMapType[] =    "edu.internet2.middleware.shibboleth.sp.provider.NativeRequestMapProvider";
-const char XML::LegacyRequestMapType[] =    "edu.internet2.middleware.shibboleth.target.provider.XMLRequestMap";
-
-const char XML::htAccessControlType[] =     "edu.internet2.middleware.shibboleth.sp.apache.provider.htAccessControl";
-const char XML::XMLAccessControlType[] =    "edu.internet2.middleware.shibboleth.sp.provider.XMLAccessControl";
-
-const XMLCh XML::SHIBTARGET_NS[] = // urn:mace:shibboleth:target:config:1.0
-{ chLatin_u, chLatin_r, chLatin_n, chColon, chLatin_m, chLatin_a, chLatin_c, chLatin_e, chColon,
-  chLatin_s, chLatin_h, chLatin_i, chLatin_b, chLatin_b, chLatin_o, chLatin_l, chLatin_e, chLatin_t, chLatin_h, chColon,
-  chLatin_t, chLatin_a, chLatin_r, chLatin_g, chLatin_e, chLatin_t, chColon,
-  chLatin_c, chLatin_o, chLatin_n, chLatin_f, chLatin_i, chLatin_g, chColon,
-  chDigit_1, chPeriod, chDigit_0, chNull
-};
-
-const XMLCh XML::SHIBTARGET_SCHEMA_ID[] = // shibboleth-targetconfig-1.0.xsd
-{ chLatin_s, chLatin_h, chLatin_i, chLatin_b, chLatin_b, chLatin_o, chLatin_l, chLatin_e, chLatin_t, chLatin_h, chDash,
-  chLatin_t, chLatin_a, chLatin_r, chLatin_g, chLatin_e, chLatin_t, chLatin_c, chLatin_o, chLatin_n, chLatin_f, chLatin_i, chLatin_g, chDash,
-  chDigit_1, chPeriod, chDigit_0, chPeriod, chLatin_x, chLatin_s, chLatin_d, chNull
-};
-
-const XMLCh XML::SAML2ASSERT_NS[] = // urn:oasis:names:tc:SAML:2.0:assertion
-{ chLatin_u, chLatin_r, chLatin_n, chColon, chLatin_o, chLatin_a, chLatin_s, chLatin_i, chLatin_s, chColon,
-  chLatin_n, chLatin_a, chLatin_m, chLatin_e, chLatin_s, chColon, chLatin_t, chLatin_c, chColon,
-  chLatin_S, chLatin_A, chLatin_M, chLatin_L, chColon, chDigit_2, chPeriod, chDigit_0, chColon,
-  chLatin_a, chLatin_s, chLatin_s, chLatin_e, chLatin_r, chLatin_t, chLatin_i, chLatin_o, chLatin_n, chNull
-};
-
-const XMLCh XML::SAML2ASSERT_SCHEMA_ID[] = // saml-schema-assertion-2.0.xsd
-{ chLatin_s, chLatin_a, chLatin_m, chLatin_l, chDash,
-  chLatin_s, chLatin_c, chLatin_h, chLatin_e, chLatin_m, chLatin_a, chDash,
-  chLatin_a, chLatin_s, chLatin_s, chLatin_e, chLatin_r, chLatin_t, chLatin_i, chLatin_o, chLatin_n, chDash,
-  chDigit_2, chPeriod, chDigit_0, chPeriod, chLatin_x, chLatin_s, chLatin_d, chNull
-};
-
-const XMLCh XML::SAML2META_NS[] = // urn:oasis:names:tc:SAML:2.0:metadata
-{ chLatin_u, chLatin_r, chLatin_n, chColon, chLatin_o, chLatin_a, chLatin_s, chLatin_i, chLatin_s, chColon,
-  chLatin_n, chLatin_a, chLatin_m, chLatin_e, chLatin_s, chColon, chLatin_t, chLatin_c, chColon,
-  chLatin_S, chLatin_A, chLatin_M, chLatin_L, chColon, chDigit_2, chPeriod, chDigit_0, chColon,
-  chLatin_m, chLatin_e, chLatin_t, chLatin_a, chLatin_d, chLatin_a, chLatin_t, chLatin_a, chNull
-};
-
-const XMLCh XML::SAML2META_SCHEMA_ID[] = // saml-schema-metadata-2.0.xsd
-{ chLatin_s, chLatin_a, chLatin_m, chLatin_l, chDash,
-  chLatin_s, chLatin_c, chLatin_h, chLatin_e, chLatin_m, chLatin_a, chDash,
-  chLatin_m, chLatin_e, chLatin_t, chLatin_a, chLatin_d, chLatin_a, chLatin_t, chLatin_a, chDash,
-  chDigit_2, chPeriod, chDigit_0, chPeriod, chLatin_x, chLatin_s, chLatin_d, chNull
-};
-
-const XMLCh XML::XMLENC_NS[] = // http://www.w3.org/2001/04/xmlenc#
-{ chLatin_h, chLatin_t, chLatin_t, chLatin_p, chColon, chForwardSlash, chForwardSlash,
-  chLatin_w, chLatin_w, chLatin_w, chPeriod, chLatin_w, chDigit_3, chPeriod, chLatin_o, chLatin_r, chLatin_g, chForwardSlash,
-  chDigit_2, chDigit_0, chDigit_0, chDigit_1, chForwardSlash, chDigit_0, chDigit_4, chForwardSlash,
-  chLatin_x, chLatin_m, chLatin_l, chLatin_e, chLatin_n, chLatin_c, chPound, chNull
-};
-
-const XMLCh XML::XMLENC_SCHEMA_ID[] = // xenc-schema.xsd
-{ chLatin_x, chLatin_e, chLatin_n, chLatin_c, chDash,
-  chLatin_s, chLatin_c, chLatin_h, chLatin_e, chLatin_m, chLatin_a, chPeriod, chLatin_x, chLatin_s, chLatin_d, chNull
-};
-
-const XMLCh XML::Literals::AAPProvider[] =
-{ chLatin_A, chLatin_A, chLatin_P, chLatin_P, chLatin_r, chLatin_o, chLatin_v, chLatin_i, chLatin_d, chLatin_e, chLatin_r, chNull };
-
-const XMLCh XML::Literals::acl[] =
-{ chLatin_a, chLatin_c, chLatin_l, chNull };
-
-const XMLCh XML::Literals::applicationId[] =
-{ chLatin_a, chLatin_p, chLatin_p, chLatin_l, chLatin_i, chLatin_c, chLatin_a, chLatin_t, chLatin_i, chLatin_o, chLatin_n,
-  chLatin_I, chLatin_d, chNull
-};
-
-const XMLCh XML::Literals::Application[] =
-{ chLatin_A, chLatin_p, chLatin_p, chLatin_l, chLatin_i, chLatin_c, chLatin_a, chLatin_t, chLatin_i, chLatin_o, chLatin_n, chNull };
-
-const XMLCh XML::Literals::Applications[] =
-{ chLatin_A, chLatin_p, chLatin_p, chLatin_l, chLatin_i, chLatin_c, chLatin_a, chLatin_t, chLatin_i, chLatin_o, chLatin_n, chLatin_s, chNull };
-
-const XMLCh XML::Literals::AttributeFactory[] =
-{ chLatin_A, chLatin_t, chLatin_t, chLatin_r, chLatin_i, chLatin_b, chLatin_u, chLatin_t, chLatin_e,
-  chLatin_F, chLatin_a, chLatin_c, chLatin_t, chLatin_o, chLatin_r, chLatin_y, chNull
-};
-
-const XMLCh XML::Literals::config[] =
-{ chLatin_c, chLatin_o, chLatin_n, chLatin_f, chLatin_i, chLatin_g, chNull };
-
-const XMLCh XML::Literals::CredentialsProvider[] =
-{ chLatin_C, chLatin_r, chLatin_e, chLatin_d, chLatin_e, chLatin_n, chLatin_t, chLatin_i, chLatin_a, chLatin_l, chLatin_s,
-  chLatin_P, chLatin_r, chLatin_o, chLatin_v, chLatin_i, chLatin_d, chLatin_e, chLatin_r, chNull
-};
-
-const XMLCh XML::Literals::CredentialUse[] =
-{ chLatin_C, chLatin_r, chLatin_e, chLatin_d, chLatin_e, chLatin_n, chLatin_t, chLatin_i, chLatin_a, chLatin_l,
-  chLatin_U, chLatin_s, chLatin_e, chNull
-};
-
-const XMLCh XML::Literals::DiagnosticService[] =
-{ chLatin_D, chLatin_i, chLatin_a, chLatin_g, chLatin_n, chLatin_o, chLatin_s, chLatin_t, chLatin_i, chLatin_c,
-  chLatin_S, chLatin_e, chLatin_r, chLatin_v, chLatin_i, chLatin_c, chLatin_e, chNull
-};
-
-const XMLCh XML::Literals::echo[] =
-{ chLatin_e, chLatin_c, chLatin_h, chLatin_o, chNull };
-
-const XMLCh XML::Literals::Extensions[] =
-{ chLatin_E, chLatin_x, chLatin_t, chLatin_e, chLatin_n, chLatin_s, chLatin_i, chLatin_o, chLatin_n, chLatin_s, chNull };
-
-const XMLCh XML::Literals::fatal[]= { chLatin_f, chLatin_a, chLatin_t, chLatin_a, chLatin_l, chNull };
-
-const XMLCh XML::Literals::Global[] =
-{ chLatin_G, chLatin_l, chLatin_o, chLatin_b, chLatin_a, chLatin_l, chNull };
-
-const XMLCh XML::Literals::Implementation[] =
-{ chLatin_I, chLatin_m, chLatin_p, chLatin_l, chLatin_e, chLatin_m, chLatin_e, chLatin_n, chLatin_t, chLatin_a, chLatin_t, chLatin_i, chLatin_o, chLatin_n, chNull };
-
-const XMLCh XML::Literals::index[] =
-{ chLatin_i, chLatin_n, chLatin_d, chLatin_e, chLatin_x, chNull };
-
-const XMLCh XML::Literals::InProcess[] =
-{ chLatin_I, chLatin_n, chLatin_P, chLatin_r, chLatin_o, chLatin_c, chLatin_e, chLatin_s, chLatin_s, chNull };
-
-const XMLCh XML::Literals::isDefault[] =
-{ chLatin_i, chLatin_s, chLatin_D, chLatin_e, chLatin_f, chLatin_a, chLatin_u, chLatin_l, chLatin_t, chNull };
-
-const XMLCh XML::Literals::Library[] =
-{ chLatin_L, chLatin_i, chLatin_b, chLatin_r, chLatin_a, chLatin_r, chLatin_y, chNull };
-
-const XMLCh XML::Literals::Listener[] =
-{ chLatin_L, chLatin_i, chLatin_s, chLatin_t, chLatin_e, chLatin_n, chLatin_e, chLatin_r, chNull };
-
-const XMLCh XML::Literals::Local[] =
-{ chLatin_L, chLatin_o, chLatin_c, chLatin_a, chLatin_l, chNull };
-
-const XMLCh XML::Literals::log[] =
-{ chLatin_l, chLatin_o, chLatin_g, chNull };
-
-const XMLCh XML::Literals::logger[] =
-{ chLatin_l, chLatin_o, chLatin_g, chLatin_g, chLatin_e, chLatin_r, chNull };
-
-const XMLCh XML::Literals::MemorySessionCache[] =
-{ chLatin_M, chLatin_e, chLatin_m, chLatin_o, chLatin_r, chLatin_y,
-  chLatin_S, chLatin_e, chLatin_s, chLatin_s, chLatin_i, chLatin_o, chLatin_n,
-  chLatin_C, chLatin_a, chLatin_c, chLatin_h, chLatin_e, chNull
-};
-
-const XMLCh XML::Literals::MetadataProvider[] =
-{ chLatin_M, chLatin_e, chLatin_t, chLatin_a, chLatin_d, chLatin_a, chLatin_t, chLatin_a,
-  chLatin_P, chLatin_r, chLatin_o, chLatin_v, chLatin_i, chLatin_d, chLatin_e, chLatin_r, chNull
-};
-
-const XMLCh XML::Literals::MySQLReplayCache[] =
-{ chLatin_M, chLatin_y, chLatin_S, chLatin_Q, chLatin_L,
-  chLatin_R, chLatin_e, chLatin_p, chLatin_l, chLatin_a, chLatin_y,
-  chLatin_C, chLatin_a, chLatin_c, chLatin_h, chLatin_e, chNull
-};
-
-const XMLCh XML::Literals::MySQLSessionCache[] =
-{ chLatin_M, chLatin_y, chLatin_S, chLatin_Q, chLatin_L,
-  chLatin_S, chLatin_e, chLatin_s, chLatin_s, chLatin_i, chLatin_o, chLatin_n,
-  chLatin_C, chLatin_a, chLatin_c, chLatin_h, chLatin_e, chNull
-};
-
-const XMLCh XML::Literals::name[]= { chLatin_n, chLatin_a, chLatin_m, chLatin_e, chNull };
-
-const XMLCh XML::Literals::Name[]= { chLatin_N, chLatin_a, chLatin_m, chLatin_e, chNull };
-
-const XMLCh XML::Literals::ODBCReplayCache[] =
-{ chLatin_O, chLatin_D, chLatin_B, chLatin_C,
-  chLatin_R, chLatin_e, chLatin_p, chLatin_l, chLatin_a, chLatin_y,
-  chLatin_C, chLatin_a, chLatin_c, chLatin_h, chLatin_e, chNull
-};
-
-const XMLCh XML::Literals::ODBCSessionCache[] =
-{ chLatin_O, chLatin_D, chLatin_B, chLatin_C,
-  chLatin_S, chLatin_e, chLatin_s, chLatin_s, chLatin_i, chLatin_o, chLatin_n,
-  chLatin_C, chLatin_a, chLatin_c, chLatin_h, chLatin_e, chNull
-};
-
-const XMLCh XML::Literals::OutOfProcess[] =
-{ chLatin_O, chLatin_u, chLatin_t, chLatin_O, chLatin_f,
-  chLatin_P, chLatin_r, chLatin_o, chLatin_c, chLatin_e, chLatin_s, chLatin_s, chNull
-};
-
-const XMLCh XML::Literals::path[]= { chLatin_p, chLatin_a, chLatin_t, chLatin_h, chNull };
-
-const XMLCh XML::Literals::RelyingParty[] =
-{ chLatin_R, chLatin_e, chLatin_l, chLatin_y, chLatin_i, chLatin_n, chLatin_g, chLatin_P, chLatin_a, chLatin_r, chLatin_t, chLatin_y, chNull };
-
-const XMLCh XML::Literals::ReplayCache[] =
-{ chLatin_R, chLatin_e, chLatin_p, chLatin_l, chLatin_a, chLatin_y, chLatin_C, chLatin_a, chLatin_c, chLatin_h, chLatin_e, chNull };
-
-const XMLCh XML::Literals::RequestMap[] =
-{ chLatin_R, chLatin_e, chLatin_q, chLatin_u, chLatin_e, chLatin_s, chLatin_t, chLatin_M, chLatin_a, chLatin_p, chNull };
-
-const XMLCh XML::Literals::RequestMapProvider[] =
-{ chLatin_R, chLatin_e, chLatin_q, chLatin_u, chLatin_e, chLatin_s, chLatin_t, chLatin_M, chLatin_a, chLatin_p,
-  chLatin_P, chLatin_r, chLatin_o, chLatin_v, chLatin_i, chLatin_d, chLatin_e, chLatin_r, chNull
-};
-
-const XMLCh XML::Literals::SessionCache[] =
-{ chLatin_S, chLatin_e, chLatin_s, chLatin_s, chLatin_i, chLatin_o, chLatin_n,
-  chLatin_C, chLatin_a, chLatin_c, chLatin_h, chLatin_e, chNull
-};
-
-const XMLCh XML::Literals::SessionInitiator[] =
-{ chLatin_S, chLatin_e, chLatin_s, chLatin_s, chLatin_i, chLatin_o, chLatin_n,
-  chLatin_I, chLatin_n, chLatin_i, chLatin_t, chLatin_i, chLatin_a, chLatin_t, chLatin_o, chLatin_r, chNull
-};
-
-const XMLCh XML::Literals::SHAR[]= { chLatin_S, chLatin_H, chLatin_A, chLatin_R, chNull };
-
-const XMLCh XML::Literals::ShibbolethTargetConfig[] =
-{ chLatin_S, chLatin_h, chLatin_i, chLatin_b, chLatin_b, chLatin_o, chLatin_l, chLatin_e, chLatin_t, chLatin_h,
-  chLatin_T, chLatin_a, chLatin_r, chLatin_g, chLatin_e, chLatin_t,
-  chLatin_C, chLatin_o, chLatin_n, chLatin_f, chLatin_i, chLatin_g, chNull
-};
-
-const XMLCh XML::Literals::SHIRE[]= { chLatin_S, chLatin_H, chLatin_I, chLatin_R, chLatin_E, chNull };
-
-const XMLCh XML::Literals::Signing[] = { chLatin_S, chLatin_i, chLatin_g, chLatin_n, chLatin_i, chLatin_n, chLatin_g, chNull };
-
-const XMLCh XML::Literals::SPConfig[] =
-{ chLatin_S, chLatin_P, chLatin_C, chLatin_o, chLatin_n, chLatin_f, chLatin_i, chLatin_g, chNull };
-
-const XMLCh XML::Literals::TCPListener[] =
-{ chLatin_T, chLatin_C, chLatin_P, chLatin_L, chLatin_i, chLatin_s, chLatin_t, chLatin_e, chLatin_n, chLatin_e, chLatin_r, chNull };
-
-const XMLCh XML::Literals::TLS[]= { chLatin_T, chLatin_L, chLatin_S, chNull };
-
-const XMLCh XML::Literals::TrustProvider[] =
-{ chLatin_T, chLatin_r, chLatin_u, chLatin_s, chLatin_t,
-  chLatin_P, chLatin_r, chLatin_o, chLatin_v, chLatin_i, chLatin_d, chLatin_e, chLatin_r, chNull
-};
-
-const XMLCh XML::Literals::type[]= { chLatin_t, chLatin_y, chLatin_p, chLatin_e, chNull };
-
-const XMLCh XML::Literals::UnixListener[] =
-{ chLatin_U, chLatin_n, chLatin_i, chLatin_x, chLatin_L, chLatin_i, chLatin_s, chLatin_t, chLatin_e, chLatin_n, chLatin_e, chLatin_r, chNull };
index 0ee0456..621feab 100644 (file)
@@ -109,11 +109,11 @@ namespace shibtarget {
     #pragma warning( disable : 4250 )
 #endif
 
-    class XMLRequestMapper : public IRequestMapper, public xmltooling::ReloadableXMLFile
+    class XMLRequestMapper : public IRequestMapper, public ReloadableXMLFile
     {
     public:
         XMLRequestMapper(const DOMElement* e)
-                : xmltooling::ReloadableXMLFile(e), m_impl(NULL), m_log(Category::getInstance(SHIBT_LOGCAT".RequestMapper")) {
+                : ReloadableXMLFile(e), m_impl(NULL), m_log(Category::getInstance(SHIBT_LOGCAT".RequestMapper")) {
             load();
         }
 
@@ -151,7 +151,7 @@ saml::IPlugIn* XMLRequestMapFactory(const DOMElement* e)
 
 short Override::acceptNode(const DOMNode* node) const
 {
-    if (!XMLString::equals(node->getNamespaceURI(),shibtarget::XML::SHIBTARGET_NS))
+    if (!XMLString::equals(node->getNamespaceURI(),shibspconstants::SHIB1SPCONFIG_NS))
         return FILTER_ACCEPT;
     const XMLCh* name=node->getLocalName();
     if (XMLString::equals(name,Host) ||
@@ -171,13 +171,13 @@ void Override::loadACL(const DOMElement* e, Category& log)
         const DOMElement* acl=XMLHelper::getFirstChildElement(e,htaccess);
         if (acl) {
             log.info("building Apache htaccess provider...");
-            plugin=saml::SAMLConfig::getConfig().getPlugMgr().newPlugin(shibtarget::XML::htAccessControlType,acl);
+            plugin=saml::SAMLConfig::getConfig().getPlugMgr().newPlugin(HTACCESS_ACCESSCONTROL,acl);
         }
         else {
             acl=XMLHelper::getFirstChildElement(e,AccessControl);
             if (acl) {
                 log.info("building XML-based Access Control provider...");
-                plugin=saml::SAMLConfig::getConfig().getPlugMgr().newPlugin(shibtarget::XML::XMLAccessControlType,acl);
+                plugin=saml::SAMLConfig::getConfig().getPlugMgr().newPlugin(XML_ACCESSCONTROL,acl);
             }
             else {
                 acl=XMLHelper::getFirstChildElement(e,AccessControlProvider);
@@ -246,7 +246,7 @@ Override::Override(const DOMElement* e, Category& log, const Override* base) : m
                 
                 if (*n) {
                     // Create a placeholder Path element for the first path segment and replant under it.
-                    DOMElement* newpath=path->getOwnerDocument()->createElementNS(shibtarget::XML::SHIBTARGET_NS,Path);
+                    DOMElement* newpath=path->getOwnerDocument()->createElementNS(shibspconstants::SHIB1SPCONFIG_NS,Path);
                     newpath->setAttributeNS(NULL,name,namebuf);
                     path->setAttributeNS(NULL,name,n);
                     path->getParentNode()->replaceChild(newpath,path);
index f086a15..0d4e635 100644 (file)
@@ -1155,7 +1155,7 @@ DDF MemorySessionCache::receive(const DDF& in)
 #endif
 
     // Find application.
-    saml::Locker confLocker(ShibTargetConfig::getConfig().getINI());
+    xmltooling::Locker confLocker(ShibTargetConfig::getConfig().getINI());
     const char* aid=in["application_id"].string();
     const IApplication* app=aid ? ShibTargetConfig::getConfig().getINI()->getApplication(aid) : NULL;
     if (!app) {
index a267b1b..3e0321a 100644 (file)
@@ -87,16 +87,17 @@ bool STConfig::init(const char* schemadir)
     ShibConfig& shibConf=ShibConfig::getConfig();
     if (!shibConf.init()) {
         log.fatal("Failed to initialize Shib library");
+        SPConfig::getConfig().term();
         samlConf.term();
         return false;
     }
 
     // Register built-in plugin types.
 
-    samlConf.getPlugMgr().regFactory(shibtarget::XML::MemorySessionCacheType,&MemoryCacheFactory);
-    samlConf.getPlugMgr().regFactory(shibtarget::XML::LegacyRequestMapType,&XMLRequestMapFactory);
-    samlConf.getPlugMgr().regFactory(shibtarget::XML::XMLRequestMapType,&XMLRequestMapFactory);
-    samlConf.getPlugMgr().regFactory(shibtarget::XML::NativeRequestMapType,&XMLRequestMapFactory);
+    samlConf.getPlugMgr().regFactory(MEMORY_SESSIONCACHE,&MemoryCacheFactory);
+    samlConf.getPlugMgr().regFactory(LEGACY_REQUESTMAP_PROVIDER,&XMLRequestMapFactory);
+    samlConf.getPlugMgr().regFactory(XML_REQUESTMAP_PROVIDER,&XMLRequestMapFactory);
+    samlConf.getPlugMgr().regFactory(NATIVE_REQUESTMAP_PROVIDER,&XMLRequestMapFactory);
     
     auto_ptr_char temp1(shibspconstants::SHIB1_SESSIONINIT_PROFILE_URI);
     samlConf.getPlugMgr().regFactory(temp1.get(),&ShibSessionInitiatorFactory);
@@ -105,11 +106,6 @@ bool STConfig::init(const char* schemadir)
     auto_ptr_char temp4(shibspconstants::SHIB1_LOGOUT_PROFILE_URI);
     samlConf.getPlugMgr().regFactory(temp4.get(),&ShibLogoutFactory);
     
-    saml::XML::registerSchema(shibtarget::XML::SHIBTARGET_NS,shibtarget::XML::SHIBTARGET_SCHEMA_ID,NULL,false);
-    saml::XML::registerSchema(samlconstants::SAML20MD_NS,shibtarget::XML::SAML2META_SCHEMA_ID,NULL,false);
-    saml::XML::registerSchema(samlconstants::SAML20_NS,shibtarget::XML::SAML2ASSERT_SCHEMA_ID,NULL,false);
-    saml::XML::registerSchema(xmlconstants::XMLENC_NS,shibtarget::XML::XMLENC_SCHEMA_ID,NULL,false);
-    
     log.info("finished initializing");
     return true;
 }
@@ -129,14 +125,16 @@ bool STConfig::load(const char* config)
 
     try {
         log.info("loading configuration file: %s", config);
-        static const XMLCh uri[] = { chLatin_u, chLatin_r, chLatin_i, chNull };
+        static const XMLCh path[] = UNICODE_LITERAL_4(p,a,t,h);
         DOMImplementation* impl=DOMImplementationRegistry::getDOMImplementation(NULL);
         DOMDocument* dummydoc=impl->createDocument();
-        DOMElement* dummy = dummydoc->createElementNS(NULL,XML::Literals::ShibbolethTargetConfig);
+        xmltooling::XercesJanitor<DOMDocument> docjanitor(dummydoc);
+        DOMElement* dummy = dummydoc->createElementNS(NULL,path);
+
         auto_ptr_XMLCh src(config);
-        dummy->setAttributeNS(NULL,uri,src.get());
+        dummy->setAttributeNS(NULL,path,src.get());
+
         m_ini=ShibTargetConfigFactory(dummy);
-        dummydoc->release();
         m_ini->init();
         
         pair<bool,unsigned int> skew=m_ini->getUnsignedInt("clockSkew");
index 1ac8ea9..02e9271 100644 (file)
@@ -308,7 +308,7 @@ DDF SAML1Consumer::receive(const DDF& in)
     // Access the application config.
     STConfig& stc=static_cast<STConfig&>(ShibTargetConfig::getConfig());
     IConfig* conf=stc.getINI();
-    saml::Locker confLocker(conf);
+    xmltooling::Locker confLocker(conf);
 
     auto_ptr_XMLCh wrecipient(recipient);
 
index df04e10..d65b10d 100644 (file)
@@ -35,6 +35,7 @@
 #include <saml/saml2/metadata/ChainingMetadataProvider.h>
 #include <xmltooling/XMLToolingConfig.h>
 #include <xmltooling/security/ChainingTrustEngine.h>
+#include <xmltooling/util/ReloadableXMLFile.h>
 
 using namespace shibsp;
 using namespace shibtarget;
@@ -145,13 +146,10 @@ namespace {
 
     // Top-level configuration implementation
     class XMLConfig;
-    class XMLConfigImpl : public ReloadableXMLFileImpl, public DOMPropertySet, public DOMNodeFilter
+    class XMLConfigImpl : public DOMPropertySet, public DOMNodeFilter
     {
     public:
-        XMLConfigImpl(const char* pathname, bool first, const XMLConfig* outer)
-            : ReloadableXMLFileImpl(pathname), m_outer(outer), m_requestMapper(NULL) { init(first); }
-        XMLConfigImpl(const DOMElement* e, bool first, const XMLConfig* outer)
-            : ReloadableXMLFileImpl(e), m_outer(outer), m_requestMapper(NULL) { init(first); }
+        XMLConfigImpl(const DOMElement* e, bool first, const XMLConfig* outer);
         ~XMLConfigImpl();
         
         IRequestMapper* m_requestMapper;
@@ -162,72 +160,115 @@ namespace {
         // Provides filter to exclude special config elements.
         short acceptNode(const DOMNode* node) const;
 
+        void setDocument(DOMDocument* doc) {
+            m_document = doc;
+        }
+
     private:
-        void init(bool first);
+        void doExtensions(const DOMElement* e, const char* label, Category& log);
+
         const XMLConfig* m_outer;
+        DOMDocument* m_document;
     };
-    
+
+#if defined (_MSC_VER)
+    #pragma warning( push )
+    #pragma warning( disable : 4250 )
+#endif
+
     class XMLConfig : public IConfig, public ReloadableXMLFile
     {
     public:
-        XMLConfig(const DOMElement* e) : ReloadableXMLFile(e), m_listener(NULL), m_sessionCache(NULL), m_replayCache(NULL) {}
+        XMLConfig(const DOMElement* e)
+            : ReloadableXMLFile(e), m_impl(NULL), m_listener(NULL), m_sessionCache(NULL), m_replayCache(NULL) {
+        }
+        
+        void init() {
+            load();
+        }
+
         ~XMLConfig() {
             delete m_impl;
-            m_impl=NULL;
             delete m_sessionCache;
-            m_sessionCache=NULL;
             delete m_replayCache;
-            m_replayCache=NULL;
             delete m_listener;
-            m_listener=NULL;
         }
 
-        void init() { getImplementation(); }
-
         // PropertySet
-        pair<bool,bool> getBool(const char* name, const char* ns=NULL) const {return static_cast<XMLConfigImpl*>(m_impl)->getBool(name,ns);}
-        pair<bool,const char*> getString(const char* name, const char* ns=NULL) const {return static_cast<XMLConfigImpl*>(m_impl)->getString(name,ns);}
-        pair<bool,const XMLCh*> getXMLString(const char* name, const char* ns=NULL) const {return static_cast<XMLConfigImpl*>(m_impl)->getXMLString(name,ns);}
-        pair<bool,unsigned int> getUnsignedInt(const char* name, const char* ns=NULL) const {return static_cast<XMLConfigImpl*>(m_impl)->getUnsignedInt(name,ns);}
-        pair<bool,int> getInt(const char* name, const char* ns=NULL) const {return static_cast<XMLConfigImpl*>(m_impl)->getInt(name,ns);}
-        const PropertySet* getPropertySet(const char* name, const char* ns="urn:mace:shibboleth:target:config:1.0") const {return static_cast<XMLConfigImpl*>(m_impl)->getPropertySet(name,ns);}
-        const DOMElement* getElement() const {return static_cast<XMLConfigImpl*>(m_impl)->getElement();}
+        pair<bool,bool> getBool(const char* name, const char* ns=NULL) const {return m_impl->getBool(name,ns);}
+        pair<bool,const char*> getString(const char* name, const char* ns=NULL) const {return m_impl->getString(name,ns);}
+        pair<bool,const XMLCh*> getXMLString(const char* name, const char* ns=NULL) const {return m_impl->getXMLString(name,ns);}
+        pair<bool,unsigned int> getUnsignedInt(const char* name, const char* ns=NULL) const {return m_impl->getUnsignedInt(name,ns);}
+        pair<bool,int> getInt(const char* name, const char* ns=NULL) const {return m_impl->getInt(name,ns);}
+        const PropertySet* getPropertySet(const char* name, const char* ns="urn:mace:shibboleth:target:config:1.0") const {return m_impl->getPropertySet(name,ns);}
+        const DOMElement* getElement() const {return m_impl->getElement();}
 
         // IConfig
         ListenerService* getListener() const {return m_listener;}
         ISessionCache* getSessionCache() const {return m_sessionCache;}
         IReplayCache* getReplayCache() const {return m_replayCache;}
-        IRequestMapper* getRequestMapper() const {return static_cast<XMLConfigImpl*>(m_impl)->m_requestMapper;}
+        IRequestMapper* getRequestMapper() const {return m_impl->m_requestMapper;}
         const IApplication* getApplication(const char* applicationId) const {
-            map<string,IApplication*>::const_iterator i=static_cast<XMLConfigImpl*>(m_impl)->m_appmap.find(applicationId);
-            return (i!=static_cast<XMLConfigImpl*>(m_impl)->m_appmap.end()) ? i->second : NULL;
+            map<string,IApplication*>::const_iterator i=m_impl->m_appmap.find(applicationId);
+            return (i!=m_impl->m_appmap.end()) ? i->second : NULL;
         }
 
         CredentialResolver* getCredentialResolver(const char* id) const {
             if (id) {
-                XMLConfigImpl* impl=static_cast<XMLConfigImpl*>(getImplementation());
-                map<string,CredentialResolver*>::const_iterator i=impl->m_credResolverMap.find(id);
-                if (i!=impl->m_credResolverMap.end())
+                map<string,CredentialResolver*>::const_iterator i=m_impl->m_credResolverMap.find(id);
+                if (i!=m_impl->m_credResolverMap.end())
                     return i->second;
             }
             return NULL;
         }
 
     protected:
-        virtual ReloadableXMLFileImpl* newImplementation(const char* pathname, bool first=true) const;
-        virtual ReloadableXMLFileImpl* newImplementation(const DOMElement* e, bool first=true) const;
+        pair<bool,DOMElement*> load();
 
     private:
         friend class XMLConfigImpl;
+        XMLConfigImpl* m_impl;
         mutable ListenerService* m_listener;
         mutable ISessionCache* m_sessionCache;
         mutable IReplayCache* m_replayCache;
     };
 
+#if defined (_MSC_VER)
+    #pragma warning( pop )
+#endif
+
+    static const XMLCh AAPProvider[] =          UNICODE_LITERAL_11(A,A,P,P,r,o,v,i,d,e,r);
+    static const XMLCh Application[] =          UNICODE_LITERAL_11(A,p,p,l,i,c,a,t,i,o,n);
+    static const XMLCh Applications[] =         UNICODE_LITERAL_12(A,p,p,l,i,c,a,t,i,o,n,s);
+    static const XMLCh AttributeFactory[] =     UNICODE_LITERAL_16(A,t,t,r,i,b,u,t,e,F,a,c,t,o,r,y);
     static const XMLCh Credentials[] =          UNICODE_LITERAL_11(C,r,e,d,e,n,t,i,a,l,s);
+    static const XMLCh CredentialsProvider[] =  UNICODE_LITERAL_19(C,r,e,d,e,n,t,i,a,l,s,P,r,o,v,i,d,e,r);
+    static const XMLCh CredentialUse[] =        UNICODE_LITERAL_13(C,r,e,d,e,n,t,i,a,l,U,s,e);
+    static const XMLCh DiagnosticService[] =    UNICODE_LITERAL_17(D,i,a,g,n,o,s,t,i,c,S,e,r,v,i,c,e);
+    static const XMLCh fatal[] =                UNICODE_LITERAL_5(f,a,t,a,l);
     static const XMLCh FileResolver[] =         UNICODE_LITERAL_12(F,i,l,e,R,e,s,o,l,v,e,r);
+    static const XMLCh Global[] =               UNICODE_LITERAL_6(G,l,o,b,a,l);
     static const XMLCh Id[] =                   UNICODE_LITERAL_2(I,d);
-    static const XMLCh type[] =                 UNICODE_LITERAL_4(t,y,p,e);
+    static const XMLCh Implementation[] =       UNICODE_LITERAL_14(I,m,p,l,e,m,e,n,t,a,t,i,o,n);
+    static const XMLCh InProcess[] =            UNICODE_LITERAL_9(I,n,P,r,o,c,e,s,s);
+    static const XMLCh Library[] =              UNICODE_LITERAL_7(L,i,b,r,a,r,y);
+    static const XMLCh Listener[] =             UNICODE_LITERAL_8(L,i,s,t,e,n,e,r);
+    static const XMLCh Local[] =                UNICODE_LITERAL_5(L,o,c,a,l);
+    static const XMLCh logger[] =               UNICODE_LITERAL_6(l,o,g,g,e,r);
+    static const XMLCh MemoryListener[] =       UNICODE_LITERAL_14(M,e,m,o,r,y,L,i,s,t,e,n,e,r);
+    static const XMLCh MemorySessionCache[] =   UNICODE_LITERAL_18(M,e,m,o,r,y,S,e,s,s,i,o,n,C,a,c,h,e);
+    static const XMLCh RelyingParty[] =         UNICODE_LITERAL_12(R,e,l,y,i,n,g,P,a,r,t,y);
+    static const XMLCh ReplayCache[] =          UNICODE_LITERAL_11(R,e,p,l,a,y,C,a,c,h,e);
+    static const XMLCh RequestMapProvider[] =   UNICODE_LITERAL_18(R,e,q,u,e,s,t,M,a,p,P,r,o,v,i,d,e,r);
+    static const XMLCh SessionCache[] =         UNICODE_LITERAL_12(S,e,s,s,i,o,n,C,a,c,h,e);
+    static const XMLCh SessionInitiator[] =     UNICODE_LITERAL_16(S,e,s,s,i,o,n,I,n,i,t,i,a,t,o,r);
+    static const XMLCh OutOfProcess[] =         UNICODE_LITERAL_12(O,u,t,O,f,P,r,o,c,e,s,s);
+    static const XMLCh TCPListener[] =          UNICODE_LITERAL_11(T,C,P,L,i,s,t,e,n,e,r);
+    static const XMLCh TrustProvider[] =        UNICODE_LITERAL_13(T,r,u,s,t,P,r,o,v,i,d,e,r);
+    static const XMLCh UnixListener[] =         UNICODE_LITERAL_12(U,n,i,x,L,i,s,t,e,n,e,r);
+    static const XMLCh _MetadataProvider[] =    UNICODE_LITERAL_16(M,e,t,a,d,a,t,a,P,r,o,v,i,d,e,r);
+    static const XMLCh _path[] =                UNICODE_LITERAL_4(p,a,t,h);
+    static const XMLCh _type[] =                UNICODE_LITERAL_4(t,y,p,e);
     
 }
 
@@ -246,7 +287,7 @@ XMLApplication::XMLApplication(
 #ifdef _DEBUG
     xmltooling::NDC ndc("XMLApplication");
 #endif
-    Category& log=Category::getInstance("shibtarget.XMLApplication");
+    Category& log=Category::getInstance(SHIBT_LOGCAT".Application");
 
     try {
         // First load any property sets.
@@ -255,6 +296,7 @@ XMLApplication::XMLApplication(
         root_remap["shireURL"]="handlerURL";
         root_remap["shireSSL"]="handlerSSL";
         load(e,log,this,&root_remap);
+
         const PropertySet* propcheck=getPropertySet("Errors");
         if (propcheck && !propcheck->getString("session").first)
             throw ConfigurationException("<Errors> element requires 'session' (or deprecated 'shire') attribute");
@@ -262,32 +304,35 @@ XMLApplication::XMLApplication(
         if (propcheck && !propcheck->getString("handlerURL").first)
             throw ConfigurationException("<Sessions> element requires 'handlerURL' (or deprecated 'shireURL') attribute");
 
-        m_hash=getId();
-        m_hash+=getString("providerId").second;
-        m_hash=SAMLArtifact::toHex(SAMLArtifactType0001::generateSourceId(m_hash.c_str()));
-
         SPConfig& conf=SPConfig::getConfig();
         XMLToolingConfig& xmlConf=XMLToolingConfig::getConfig();
         opensaml::SAMLConfig& samlConf=opensaml::SAMLConfig::getConfig();
         SAMLConfig& shibConf=SAMLConfig::getConfig();
 
+        m_hash=getId();
+        m_hash+=getString("providerId").second;
+        m_hash=samlConf.hashSHA1(m_hash.c_str(), true);
+
+        const DOMElement* child;
+        IPlugIn* plugin=NULL;
+
         // Process handlers.
         bool hardACS=false, hardSessionInit=false;
-        DOMElement* handler=saml::XML::getFirstChildElement(propcheck->getElement());
-        while (handler) {
+        child = XMLHelper::getFirstChildElement(propcheck->getElement());
+        while (child) {
             // A handler is split across a property set and the plugin itself, which is based on the Binding property.
             // We build both objects first and then insert them into various structures for lookup.
             IHandler* hobj=NULL;
             DOMPropertySet* hprops=new DOMPropertySet();
             try {
-                hprops->load(handler,log,this); // filter irrelevant for now, no embedded elements expected
+                hprops->load(child,log,this); // filter irrelevant for now, no embedded elements expected
                 const char* bindprop=hprops->getString("Binding").second;
                 if (!bindprop)
                     throw ConfigurationException("Handler element has no Binding attribute, skipping it...");
-                IPlugIn* hplug=shibConf.getPlugMgr().newPlugin(bindprop,handler);
-                hobj=dynamic_cast<IHandler*>(hplug);
+                plugin=shibConf.getPlugMgr().newPlugin(bindprop,child);
+                hobj=dynamic_cast<IHandler*>(plugin);
                 if (!hobj) {
-                    delete hplug;
+                    delete plugin;
                     throw UnknownExtensionException(
                         "Plugin for binding ($1) does not implement IHandler interface.",xmltooling::params(1,bindprop)
                         );
@@ -303,8 +348,7 @@ XMLApplication::XMLApplication(
             const char* location=hprops ? hprops->getString("Location").second : NULL;
             if (!location) {
                 delete hprops;
-                hprops=NULL;
-                handler=saml::XML::getNextSiblingElement(handler);
+                child = XMLHelper::getNextSiblingElement(child);
                 continue;
             }
             
@@ -320,7 +364,7 @@ XMLApplication::XMLApplication(
                 m_handlerMap[string("/") + location]=hobj;
 
             // If it's an ACS or SI, handle index/id mappings and defaulting.
-            if (XMLHelper::isNodeNamed(handler,samlconstants::SAML20MD_NS,AssertionConsumerService::LOCAL_NAME)) {
+            if (XMLHelper::isNodeNamed(child,samlconstants::SAML20MD_NS,AssertionConsumerService::LOCAL_NAME)) {
                 // Map it.
 #ifdef HAVE_GOOD_STL
                 const XMLCh* binding=hprops->getXMLString("Binding").second;
@@ -345,7 +389,7 @@ XMLApplication::XMLApplication(
                         m_acsDefault=hobj;
                 }
             }
-            else if (XMLHelper::isNodeNamed(handler,shibtarget::XML::SHIBTARGET_NS,SHIBT_L(SessionInitiator))) {
+            else if (XMLString::equals(child->getLocalName(),SessionInitiator)) {
                 pair<bool,const char*> si_id=hprops->getString("id");
                 if (si_id.first && si_id.second)
                     m_sessionInitMap[si_id.second]=hobj;
@@ -361,7 +405,7 @@ XMLApplication::XMLApplication(
                         m_sessionInitDefault=hobj;
                 }
             }
-            handler=saml::XML::getNextSiblingElement(handler);
+            child = XMLHelper::getNextSiblingElement(child);
         }
 
         // If no handlers defined at the root, assume a legacy configuration.
@@ -370,25 +414,25 @@ XMLApplication::XMLApplication(
             // We use the Sessions element itself as the PropertySet.
 
             xmltooling::auto_ptr_char b1(shibspconstants::SHIB1_SESSIONINIT_PROFILE_URI);
-            IPlugIn* hplug=shibConf.getPlugMgr().newPlugin(b1.get(),propcheck->getElement());
-            IHandler* h1=dynamic_cast<IHandler*>(hplug);
+            plugin=shibConf.getPlugMgr().newPlugin(b1.get(),propcheck->getElement());
+            IHandler* h1=dynamic_cast<IHandler*>(plugin);
             if (!h1) {
-                delete hplug;
-                throw UnsupportedExtensionException(
-                    "Plugin for binding ($1) does not implement IHandler interface.",saml::params(1,b1.get())
+                delete plugin;
+                throw UnknownExtensionException(
+                    "Plugin for binding ($1) does not implement IHandler interface.",xmltooling::params(1,b1.get())
                     );
             }
             h1->setProperties(propcheck);
             m_handlers.push_back(h1);
             m_sessionInitDefault=h1;
 
-            xmltooling::auto_ptr_char b2(SAMLBrowserProfile::BROWSER_POST);
-            hplug=shibConf.getPlugMgr().newPlugin(b2.get(),propcheck->getElement());
-            IHandler* h2=dynamic_cast<IHandler*>(hplug);
+            xmltooling::auto_ptr_char b2(samlconstants::SAML1_PROFILE_BROWSER_POST);
+            plugin=shibConf.getPlugMgr().newPlugin(b2.get(),propcheck->getElement());
+            IHandler* h2=dynamic_cast<IHandler*>(plugin);
             if (!h2) {
-                delete hplug;
-                throw UnsupportedExtensionException(
-                    "Plugin for binding ($1) does not implement IHandler interface.",saml::params(1,b2.get())
+                delete plugin;
+                throw UnknownExtensionException(
+                    "Plugin for binding ($1) does not implement IHandler interface.",xmltooling::params(1,b2.get())
                     );
             }
             h2->setProperties(propcheck);
@@ -398,61 +442,59 @@ XMLApplication::XMLApplication(
         }
         
         // Process general configuration elements.
-        unsigned int i;
-        DOMNodeList* nlist=e->getElementsByTagNameNS(saml::XML::SAML_NS,L(AttributeDesignator));
+        XMLSize_t i;
+        DOMNodeList* nlist=e->getElementsByTagNameNS(samlconstants::SAML1_NS,AttributeDesignator::LOCAL_NAME);
         for (i=0; nlist && i<nlist->getLength(); i++)
             if (nlist->item(i)->getParentNode()->isSameNode(e))
                 m_designators.push_back(new SAMLAttributeDesignator(static_cast<DOMElement*>(nlist->item(i))));
 
-        nlist=e->getElementsByTagNameNS(saml::XML::SAML_NS,L(Audience));
+        nlist=e->getElementsByTagNameNS(samlconstants::SAML1_NS,Audience::LOCAL_NAME);
         for (i=0; nlist && i<nlist->getLength(); i++)
-            if (nlist->item(i)->getParentNode()->isSameNode(e))
+            if (nlist->item(i)->getParentNode()->isSameNode(e) && nlist->item(i)->hasChildNodes())
                 m_audiences.push_back(nlist->item(i)->getFirstChild()->getNodeValue());
 
         // Always include our own providerId as an audience.
         m_audiences.push_back(getXMLString("providerId").second);
 
         if (conf.isEnabled(SPConfig::AAP)) {
-            nlist=e->getElementsByTagNameNS(shibtarget::XML::SHIBTARGET_NS,SHIBT_L(AAPProvider));
-            for (i=0; nlist && i<nlist->getLength(); i++) {
-                if (nlist->item(i)->getParentNode()->isSameNode(e)) {
-                    xmltooling::auto_ptr_char type(static_cast<DOMElement*>(nlist->item(i))->getAttributeNS(NULL,SHIBT_L(type)));
-                    log.info("building AAP provider of type %s...",type.get());
-                    try {
-                        IPlugIn* plugin=shibConf.getPlugMgr().newPlugin(type.get(),static_cast<DOMElement*>(nlist->item(i)));
-                        IAAP* aap=dynamic_cast<IAAP*>(plugin);
-                        if (aap)
-                            m_aaps.push_back(aap);
-                        else {
-                            delete plugin;
-                            log.crit("plugin was not an AAP provider");
-                        }
-                    }
-                    catch (exception& ex) {
-                        log.crit("error building AAP provider: %s",ex.what());
+            child = XMLHelper::getFirstChildElement(e,AAPProvider);
+            while (child) {
+                xmltooling::auto_ptr_char type(child->getAttributeNS(NULL,_type));
+                log.info("building AAP provider of type %s...",type.get());
+                try {
+                    plugin=shibConf.getPlugMgr().newPlugin(type.get(),child);
+                    IAAP* aap=dynamic_cast<IAAP*>(plugin);
+                    if (aap)
+                        m_aaps.push_back(aap);
+                    else {
+                        delete plugin;
+                        log.crit("plugin was not an AAP provider");
                     }
                 }
+                catch (exception& ex) {
+                    log.crit("error building AAP provider: %s", ex.what());
+                }
+
+                child = XMLHelper::getNextSiblingElement(child,AAPProvider);
             }
         }
 
         if (conf.isEnabled(SPConfig::Metadata)) {
             vector<MetadataProvider*> os2providers;
-            nlist=e->getElementsByTagNameNS(shibtarget::XML::SHIBTARGET_NS,SHIBT_L(MetadataProvider));
-            for (i=0; nlist && i<nlist->getLength(); i++) {
-                if (nlist->item(i)->getParentNode()->isSameNode(e)) {
-                    xmltooling::auto_ptr_char type(static_cast<DOMElement*>(nlist->item(i))->getAttributeNS(NULL,SHIBT_L(type)));
-                    log.info("building metadata provider of type %s...",type.get());
-                    try {
-                        auto_ptr<MetadataProvider> mp(
-                            samlConf.MetadataProviderManager.newPlugin(type.get(),static_cast<DOMElement*>(nlist->item(i)))
-                            );
-                        mp->init();
-                        os2providers.push_back(mp.release());
-                    }
-                    catch (exception& ex) {
-                        log.crit("error building metadata provider: %s",ex.what());
-                    }
+            child = XMLHelper::getFirstChildElement(e,_MetadataProvider);
+            while (child) {
+                xmltooling::auto_ptr_char type(child->getAttributeNS(NULL,_type));
+                log.info("building metadata provider of type %s...",type.get());
+                try {
+                    auto_ptr<MetadataProvider> mp(samlConf.MetadataProviderManager.newPlugin(type.get(),child));
+                    mp->init();
+                    os2providers.push_back(mp.release());
+                }
+                catch (exception& ex) {
+                    log.crit("error building/initializing metadata provider: %s", ex.what());
                 }
+
+                child = XMLHelper::getNextSiblingElement(child,_MetadataProvider);
             }
             
             if (os2providers.size()==1)
@@ -475,89 +517,69 @@ XMLApplication::XMLApplication(
 
         if (conf.isEnabled(SPConfig::Trust)) {
             ChainingTrustEngine* chainTrust = NULL;
-            nlist=e->getElementsByTagNameNS(shibtarget::XML::SHIBTARGET_NS,SHIBT_L(TrustProvider));
-            for (i=0; nlist && i<nlist->getLength(); i++) {
-                if (nlist->item(i)->getParentNode()->isSameNode(e)) {
-                    xmltooling::auto_ptr_char type(static_cast<DOMElement*>(nlist->item(i))->getAttributeNS(NULL,SHIBT_L(type)));
-                    log.info("building trust provider of type %s...",type.get());
-                    try {
-                        if (!m_trust) {
-                            // For compatibility with old engine types, we're assuming a Shib engine is likely,
-                            // which requires chaining, so we'll build that regardless.
-                            m_trust = xmlConf.TrustEngineManager.newPlugin(CHAINING_TRUSTENGINE,NULL);
-                            chainTrust = dynamic_cast<ChainingTrustEngine*>(m_trust);
-                        }
-                        if (!strcmp(type.get(),"edu.internet2.middleware.shibboleth.common.provider.ShibbolethTrust")) {
-                            chainTrust->addTrustEngine(
-                                xmlConf.TrustEngineManager.newPlugin(
-                                    EXPLICIT_KEY_TRUSTENGINE,static_cast<DOMElement*>(nlist->item(i))
-                                )
-                            );
-                            chainTrust->addTrustEngine(
-                                xmlConf.TrustEngineManager.newPlugin(
-                                    SHIBBOLETH_PKIX_TRUSTENGINE,static_cast<DOMElement*>(nlist->item(i))
-                                )
-                            );
-                        }
-                        else if (!strcmp(type.get(),"edu.internet2.middleware.shibboleth.common.provider.BasicTrust")) {
-                            chainTrust->addTrustEngine(
-                                xmlConf.TrustEngineManager.newPlugin(
-                                    EXPLICIT_KEY_TRUSTENGINE,static_cast<DOMElement*>(nlist->item(i))
-                                )
-                            );
-                        }
-                        else {
-                            chainTrust->addTrustEngine(
-                                xmlConf.TrustEngineManager.newPlugin(type.get(),static_cast<DOMElement*>(nlist->item(i)))
-                            );
-                        }
+            child = XMLHelper::getFirstChildElement(e,TrustProvider);
+            while (child) {
+                xmltooling::auto_ptr_char type(child->getAttributeNS(NULL,_type));
+                log.info("building trust provider of type %s...",type.get());
+                try {
+                    if (!m_trust) {
+                        // For compatibility with old engine types, we're assuming a Shib engine is likely,
+                        // which requires chaining, so we'll build that regardless.
+                        m_trust = xmlConf.TrustEngineManager.newPlugin(CHAINING_TRUSTENGINE,NULL);
+                        chainTrust = dynamic_cast<ChainingTrustEngine*>(m_trust);
                     }
-                    catch (exception& ex) {
-                        log.crit("error building trust provider: %s",ex.what());
+                    if (!strcmp(type.get(),"edu.internet2.middleware.shibboleth.common.provider.ShibbolethTrust")) {
+                        chainTrust->addTrustEngine(xmlConf.TrustEngineManager.newPlugin(EXPLICIT_KEY_TRUSTENGINE,child));
+                        chainTrust->addTrustEngine(xmlConf.TrustEngineManager.newPlugin(SHIBBOLETH_PKIX_TRUSTENGINE,child));
                     }
+                    else if (!strcmp(type.get(),"edu.internet2.middleware.shibboleth.common.provider.BasicTrust")) {
+                        chainTrust->addTrustEngine(xmlConf.TrustEngineManager.newPlugin(EXPLICIT_KEY_TRUSTENGINE,child));
+                    }
+                    else {
+                        chainTrust->addTrustEngine(xmlConf.TrustEngineManager.newPlugin(type.get(),child));
+                    }
+                }
+                catch (exception& ex) {
+                    log.crit("error building trust provider: %s",ex.what());
                 }
+    
+                child = XMLHelper::getNextSiblingElement(child,TrustProvider);
             }
         }
         
         // Finally, load credential mappings.
-        const DOMElement* cu=saml::XML::getFirstChildElement(e,shibtarget::XML::SHIBTARGET_NS,SHIBT_L(CredentialUse));
-        if (cu) {
+        child = XMLHelper::getFirstChildElement(e,CredentialUse);
+        if (child) {
             m_credDefault=new DOMPropertySet();
-            m_credDefault->load(cu,log,this);
-            cu=saml::XML::getFirstChildElement(cu,shibtarget::XML::SHIBTARGET_NS,SHIBT_L(RelyingParty));
-            while (cu) {
+            m_credDefault->load(child,log,this);
+            child = XMLHelper::getFirstChildElement(child,RelyingParty);
+            while (child) {
                 DOMPropertySet* rp=new DOMPropertySet();
-                rp->load(cu,log,this);
-                m_credMap[cu->getAttributeNS(NULL,SHIBT_L(Name))]=rp;
-                cu=saml::XML::getNextSiblingElement(cu,shibtarget::XML::SHIBTARGET_NS,SHIBT_L(RelyingParty));
+                rp->load(child,log,this);
+                m_credMap[child->getAttributeNS(NULL,opensaml::saml2::Attribute::NAME_ATTRIB_NAME)]=rp;
+                child = XMLHelper::getNextSiblingElement(child,RelyingParty);
             }
         }
         
         if (conf.isEnabled(SPConfig::OutOfProcess)) {
             // Really finally, build local browser profile and binding objects.
-            m_profile=new ShibBrowserProfile(
-                this,
-                getMetadataProvider(),
-                getTrustEngine()
-                );
+            m_profile=new ShibBrowserProfile(this, getMetadataProvider(), getTrustEngine());
             m_bindingHook=new ShibHTTPHook(getTrustEngine());
             m_binding=SAMLBinding::getInstance(SAMLBinding::SOAP);
             SAMLSOAPHTTPBinding* bptr=dynamic_cast<SAMLSOAPHTTPBinding*>(m_binding);
             if (!bptr) {
                 log.fatal("binding implementation was not SOAP over HTTP");
-                throw UnsupportedExtensionException("binding implementation was not SOAP over HTTP");
+                throw UnknownExtensionException("binding implementation was not SOAP over HTTP");
             }
             bptr->addHook(m_bindingHook,m_bindingHook); // the hook is its own global context
         }
     }
-    catch (exception& e) {
-        log.errorStream() << "Error while processing applicaton element: " << e.what() << CategoryStream::ENDLINE;
+    catch (exception&) {
         cleanup();
         throw;
     }
 #ifndef _DEBUG
     catch (...) {
-        log.error("Unexpected error while processing application element");
         cleanup();
         throw;
     }
@@ -586,21 +608,21 @@ void XMLApplication::cleanup()
 
 short XMLApplication::acceptNode(const DOMNode* node) const
 {
-    if (saml::XML::isElementNamed(static_cast<const DOMElement*>(node),saml::XML::SAML_NS,L(AttributeDesignator)))
+    if (XMLHelper::isNodeNamed(node,samlconstants::SAML1_NS,AttributeDesignator::LOCAL_NAME))
         return FILTER_REJECT;
-    else if (saml::XML::isElementNamed(static_cast<const DOMElement*>(node),saml::XML::SAML_NS,L(Audience)))
+    else if (XMLHelper::isNodeNamed(node,samlconstants::SAML1_NS,Audience::LOCAL_NAME))
         return FILTER_REJECT;
     const XMLCh* name=node->getLocalName();
-    if (XMLString::equals(name,SHIBT_L(Application)) ||
+    if (XMLString::equals(name,Application) ||
         XMLString::equals(name,AssertionConsumerService::LOCAL_NAME) ||
         XMLString::equals(name,SingleLogoutService::LOCAL_NAME) ||
-        XMLString::equals(name,SHIBT_L(DiagnosticService)) ||
-        XMLString::equals(name,SHIBT_L(SessionInitiator)) ||
-        XMLString::equals(name,SHIBT_L(AAPProvider)) ||
-        XMLString::equals(name,SHIBT_L(CredentialUse)) ||
-        XMLString::equals(name,SHIBT_L(RelyingParty)) ||
-        XMLString::equals(name,SHIBT_L(MetadataProvider)) ||
-        XMLString::equals(name,SHIBT_L(TrustProvider)))
+        XMLString::equals(name,DiagnosticService) ||
+        XMLString::equals(name,SessionInitiator) ||
+        XMLString::equals(name,AAPProvider) ||
+        XMLString::equals(name,CredentialUse) ||
+        XMLString::equals(name,RelyingParty) ||
+        XMLString::equals(name,_MetadataProvider) ||
+        XMLString::equals(name,TrustProvider))
         return FILTER_REJECT;
 
     return FILTER_ACCEPT;
@@ -720,7 +742,7 @@ void XMLApplication::validateToken(SAMLAssertion* token, time_t ts, const RoleDe
 #ifdef _DEBUG
     xmltooling::NDC ndc("validateToken");
 #endif
-    Category& log=Category::getInstance("shibtarget.XMLApplication");
+    Category& log=Category::getInstance(SHIBT_LOGCAT".Application");
 
     // First we verify the time conditions, using the specified timestamp, if non-zero.
     SAMLConfig& config=SAMLConfig::getConfig();
@@ -826,231 +848,165 @@ const IHandler* XMLApplication::getHandler(const char* path) const
     return m_base ? m_base->getHandler(path) : NULL;
 }
 
-ReloadableXMLFileImpl* XMLConfig::newImplementation(const char* pathname, bool first) const
-{
-    return new XMLConfigImpl(pathname,first,this);
-}
-
-ReloadableXMLFileImpl* XMLConfig::newImplementation(const DOMElement* e, bool first) const
-{
-    return new XMLConfigImpl(e,first,this);
-}
-
 short XMLConfigImpl::acceptNode(const DOMNode* node) const
 {
-    if (XMLString::compareString(node->getNamespaceURI(),shibtarget::XML::SHIBTARGET_NS))
+    if (!XMLString::equals(node->getNamespaceURI(),shibspconstants::SHIB1SPCONFIG_NS))
         return FILTER_ACCEPT;
     const XMLCh* name=node->getLocalName();
-    if (XMLString::equals(name,SHIBT_L(Applications)) ||
-        XMLString::equals(name,SHIBT_L(AttributeFactory)) ||
-        XMLString::equals(name,SHIBT_L(CredentialsProvider)) ||
-        XMLString::equals(name,SHIBT_L(Extensions)) ||
-        XMLString::equals(name,SHIBT_L(Implementation)) ||
-        XMLString::equals(name,SHIBT_L(Listener)) ||
-        XMLString::equals(name,SHIBT_L(MemorySessionCache)) ||
-        XMLString::equals(name,SHIBT_L(MySQLReplayCache)) ||
-        XMLString::equals(name,SHIBT_L(MySQLSessionCache)) ||
-        XMLString::equals(name,SHIBT_L(RequestMap)) ||
-        XMLString::equals(name,SHIBT_L(RequestMapProvider)) ||
-        XMLString::equals(name,SHIBT_L(ReplayCache)) ||
-        XMLString::equals(name,SHIBT_L(SessionCache)) ||
-        XMLString::equals(name,SHIBT_L(TCPListener)) ||
-        XMLString::equals(name,SHIBT_L(UnixListener)))
+    if (XMLString::equals(name,Applications) ||
+        XMLString::equals(name,AttributeFactory) ||
+        XMLString::equals(name,Credentials) ||
+        XMLString::equals(name,CredentialsProvider) ||
+        XMLString::equals(name,Extensions::LOCAL_NAME) ||
+        XMLString::equals(name,Implementation) ||
+        XMLString::equals(name,Listener) ||
+        XMLString::equals(name,MemoryListener) ||
+        XMLString::equals(name,MemorySessionCache) ||
+        XMLString::equals(name,RequestMapProvider) ||
+        XMLString::equals(name,ReplayCache) ||
+        XMLString::equals(name,SessionCache) ||
+        XMLString::equals(name,TCPListener) ||
+        XMLString::equals(name,UnixListener))
         return FILTER_REJECT;
 
     return FILTER_ACCEPT;
 }
 
-void XMLConfigImpl::init(bool first)
+void XMLConfigImpl::doExtensions(const DOMElement* e, const char* label, Category& log)
+{
+    const DOMElement* exts=XMLHelper::getFirstChildElement(e,Extensions::LOCAL_NAME);
+    if (exts) {
+        exts=XMLHelper::getFirstChildElement(exts,Library);
+        while (exts) {
+            xmltooling::auto_ptr_char path(exts->getAttributeNS(NULL,_path));
+            try {
+                if (path.get()) {
+                    // TODO: replace with xmltooling extension load...
+                    SAMLConfig::getConfig().saml_register_extension(path.get(),(void*)exts);
+                    log.debug("loaded %s extension library (%s)", label, path.get());
+                }
+            }
+            catch (exception& e) {
+                const XMLCh* fatal=exts->getAttributeNS(NULL,fatal);
+                if (fatal && (*fatal==chLatin_t || *fatal==chDigit_1)) {
+                    log.fatal("unable to load mandatory %s extension library %s: %s", label, path.get(), e.what());
+                    throw;
+                }
+                else {
+                    log.crit("unable to load optional %s extension library %s: %s", label, path.get(), e.what());
+                }
+            }
+            exts=XMLHelper::getNextSiblingElement(exts,Library);
+        }
+    }
+}
+
+XMLConfigImpl::XMLConfigImpl(const DOMElement* e, bool first, const XMLConfig* outer) : m_outer(outer), m_requestMapper(NULL)
 {
 #ifdef _DEBUG
-    xmltooling::NDC ndc("init");
+    xmltooling::NDC ndc("XMLConfigImpl");
 #endif
-    Category& log=Category::getInstance("shibtarget.Config");
+    Category& log=Category::getInstance(SHIBT_LOGCAT".Config");
 
     try {
-        if (!saml::XML::isElementNamed(ReloadableXMLFileImpl::m_root,shibtarget::XML::SHIBTARGET_NS,SHIBT_L(ShibbolethTargetConfig)) &&
-            !saml::XML::isElementNamed(ReloadableXMLFileImpl::m_root,shibtarget::XML::SHIBTARGET_NS,SHIBT_L(SPConfig))) {
-            log.error("Construction requires a valid configuration file: (conf:SPConfig as root element)");
-            throw ConfigurationException("Construction requires a valid configuration file: (conf:SPConfig as root element)");
-        }
-
         SAMLConfig& shibConf=SAMLConfig::getConfig();
         SPConfig& conf=SPConfig::getConfig();
-        const DOMElement* SHAR=saml::XML::getFirstChildElement(ReloadableXMLFileImpl::m_root,shibtarget::XML::SHIBTARGET_NS,SHIBT_L(SHAR));
-        if (!SHAR)
-            SHAR=saml::XML::getFirstChildElement(ReloadableXMLFileImpl::m_root,shibtarget::XML::SHIBTARGET_NS,SHIBT_L(Global));
+        const DOMElement* SHAR=XMLHelper::getFirstChildElement(e,OutOfProcess);
         if (!SHAR)
-            SHAR=saml::XML::getFirstChildElement(ReloadableXMLFileImpl::m_root,shibtarget::XML::SHIBTARGET_NS,SHIBT_L(OutOfProcess));
-        const DOMElement* SHIRE=saml::XML::getFirstChildElement(ReloadableXMLFileImpl::m_root,shibtarget::XML::SHIBTARGET_NS,SHIBT_L(SHIRE));
+            SHAR=XMLHelper::getFirstChildElement(e,Global);
+        const DOMElement* SHIRE=XMLHelper::getFirstChildElement(e,InProcess);
         if (!SHIRE)
-            SHIRE=saml::XML::getFirstChildElement(ReloadableXMLFileImpl::m_root,shibtarget::XML::SHIBTARGET_NS,SHIBT_L(Local));
-        if (!SHIRE)
-            SHIRE=saml::XML::getFirstChildElement(ReloadableXMLFileImpl::m_root,shibtarget::XML::SHIBTARGET_NS,SHIBT_L(InProcess));
+            SHIRE=XMLHelper::getFirstChildElement(e,Local);
 
         // Initialize log4cpp manually in order to redirect log messages as soon as possible.
         if (conf.isEnabled(SPConfig::Logging)) {
-            const XMLCh* logger=NULL;
+            const XMLCh* logconf=NULL;
             if (conf.isEnabled(SPConfig::OutOfProcess))
-                logger=SHAR->getAttributeNS(NULL,SHIBT_L(logger));
+                logconf=SHAR->getAttributeNS(NULL,logger);
             else if (conf.isEnabled(SPConfig::InProcess))
-                logger=SHIRE->getAttributeNS(NULL,SHIBT_L(logger));
-            if (!logger || !*logger)
-                logger=ReloadableXMLFileImpl::m_root->getAttributeNS(NULL,SHIBT_L(logger));
-            if (logger && *logger) {
-                xmltooling::auto_ptr_char logpath(logger);
+                logconf=SHIRE->getAttributeNS(NULL,logger);
+            if (!logconf || !*logconf)
+                logconf=e->getAttributeNS(NULL,logger);
+            if (logconf && *logconf) {
+                xmltooling::auto_ptr_char logpath(logconf);
                 log.debug("loading new logging configuration from (%s), check log destination for status of configuration",logpath.get());
-                try {
-                    PropertyConfigurator::configure(logpath.get());
-                }
-                catch (ConfigureFailure& e) {
-                    log.error("Error reading logging configuration: %s",e.what());
-                }
+                XMLToolingConfig::getConfig().log_config(logpath.get());
             }
         }
         
         // First load any property sets.
         map<string,string> root_remap;
-        root_remap["SHAR"]="OutOfProcess";
-        root_remap["SHIRE"]="InProcess";
         root_remap["Global"]="OutOfProcess";
         root_remap["Local"]="InProcess";
-        load(ReloadableXMLFileImpl::m_root,log,this,&root_remap);
+        load(e,log,this,&root_remap);
+
+        const DOMElement* child;
+        IPlugIn* plugin=NULL;
+        string plugtype;
 
         // Much of the processing can only occur on the first instantiation.
         if (first) {
-            // Now load any extensions to insure any needed plugins are registered.
-            DOMElement* exts=
-                saml::XML::getFirstChildElement(ReloadableXMLFileImpl::m_root,shibtarget::XML::SHIBTARGET_NS,SHIBT_L(Extensions));
-            if (exts) {
-                exts=saml::XML::getFirstChildElement(exts,shibtarget::XML::SHIBTARGET_NS,SHIBT_L(Library));
-                while (exts) {
-                    xmltooling::auto_ptr_char path(exts->getAttributeNS(NULL,SHIBT_L(path)));
-                    try {
-                        SAMLConfig::getConfig().saml_register_extension(path.get(),exts);
-                        log.debug("loaded global extension library %s",path.get());
-                    }
-                    catch (exception& e) {
-                        const XMLCh* fatal=exts->getAttributeNS(NULL,SHIBT_L(fatal));
-                        if (fatal && (*fatal==chLatin_t || *fatal==chDigit_1)) {
-                            log.fatal("unable to load mandatory global extension library %s: %s", path.get(), e.what());
-                            throw;
-                        }
-                        else
-                            log.crit("unable to load optional global extension library %s: %s", path.get(), e.what());
-                    }
-                    exts=saml::XML::getNextSiblingElement(exts,shibtarget::XML::SHIBTARGET_NS,SHIBT_L(Library));
-                }
-            }
-            
-            if (conf.isEnabled(SPConfig::OutOfProcess)) {
-                exts=saml::XML::getFirstChildElement(SHAR,shibtarget::XML::SHIBTARGET_NS,SHIBT_L(Extensions));
-                if (exts) {
-                    exts=saml::XML::getFirstChildElement(exts,shibtarget::XML::SHIBTARGET_NS,SHIBT_L(Library));
-                    while (exts) {
-                        xmltooling::auto_ptr_char path(exts->getAttributeNS(NULL,SHIBT_L(path)));
-                        try {
-                            SAMLConfig::getConfig().saml_register_extension(path.get(),exts);
-                            log.debug("loaded Global extension library %s",path.get());
-                        }
-                        catch (exception& e) {
-                            const XMLCh* fatal=exts->getAttributeNS(NULL,SHIBT_L(fatal));
-                            if (fatal && (*fatal==chLatin_t || *fatal==chDigit_1)) {
-                                log.fatal("unable to load mandatory Global extension library %s: %s", path.get(), e.what());
-                                throw;
-                            }
-                            else
-                                log.crit("unable to load optional Global extension library %s: %s", path.get(), e.what());
-                        }
-                        exts=saml::XML::getNextSiblingElement(exts,shibtarget::XML::SHIBTARGET_NS,SHIBT_L(Library));
-                    }
-                }
-            }
 
-            if (conf.isEnabled(SPConfig::InProcess)) {
-                exts=saml::XML::getFirstChildElement(SHIRE,shibtarget::XML::SHIBTARGET_NS,SHIBT_L(Extensions));
-                if (exts) {
-                    exts=saml::XML::getFirstChildElement(exts,shibtarget::XML::SHIBTARGET_NS,SHIBT_L(Library));
-                    while (exts) {
-                        xmltooling::auto_ptr_char path(exts->getAttributeNS(NULL,SHIBT_L(path)));
-                        try {
-                            SAMLConfig::getConfig().saml_register_extension(path.get(),exts);
-                            log.debug("loaded Local extension library %s",path.get());
-                        }
-                        catch (exception& e) {
-                            const XMLCh* fatal=exts->getAttributeNS(NULL,SHIBT_L(fatal));
-                            if (fatal && (*fatal==chLatin_t || *fatal==chDigit_1)) {
-                                log.fatal("unable to load mandatory Local extension library %s: %s", path.get(), e.what());
-                                throw;
-                            }
-                            else
-                                log.crit("unable to load optional Local extension library %s: %s", path.get(), e.what());
-                        }
-                        exts=saml::XML::getNextSiblingElement(exts,shibtarget::XML::SHIBTARGET_NS,SHIBT_L(Library));
-                    }
-                }
-            }
+            // Extensions
+            doExtensions(e, "global", log);
+            if (conf.isEnabled(SPConfig::OutOfProcess))
+                doExtensions(SHAR, "out of process", log);
+
+            if (conf.isEnabled(SPConfig::InProcess))
+                doExtensions(SHIRE, "in process", log);
             
             // Instantiate the ListenerService and SessionCache objects.
             if (conf.isEnabled(SPConfig::Listener)) {
-                exts=saml::XML::getFirstChildElement(SHAR,shibtarget::XML::SHIBTARGET_NS,SHIBT_L(UnixListener));
-                if (exts) {
-                    log.info("building Listener of type %s...",UNIX_LISTENER_SERVICE);
-                    m_outer->m_listener=conf.ListenerServiceManager.newPlugin(UNIX_LISTENER_SERVICE,exts);
-                }
+                child=XMLHelper::getFirstChildElement(SHAR,UnixListener);
+                if (child)
+                    plugtype=UNIX_LISTENER_SERVICE;
                 else {
-                    exts=saml::XML::getFirstChildElement(SHAR,shibtarget::XML::SHIBTARGET_NS,SHIBT_L(TCPListener));
-                    if (exts) {
-                        log.info("building Listener of type %s...",TCP_LISTENER_SERVICE);
-                        m_outer->m_listener=conf.ListenerServiceManager.newPlugin(TCP_LISTENER_SERVICE,exts);
-                    }
+                    child=XMLHelper::getFirstChildElement(SHAR,TCPListener);
+                    if (child)
+                        plugtype=TCP_LISTENER_SERVICE;
                     else {
-                        exts=saml::XML::getFirstChildElement(SHAR,shibtarget::XML::SHIBTARGET_NS,SHIBT_L(Listener));
-                        if (exts) {
-                            xmltooling::auto_ptr_char type(exts->getAttributeNS(NULL,SHIBT_L(type)));
-                            log.info("building Listener of type %s...",type.get());
-                            m_outer->m_listener=conf.ListenerServiceManager.newPlugin(type.get(),exts);
-                        }
+                        child=XMLHelper::getFirstChildElement(SHAR,MemoryListener);
+                        if (child)
+                            plugtype=MEMORY_LISTENER_SERVICE;
                         else {
-                            log.fatal("can't build Listener object, missing conf:Listener element?");
-                            throw ConfigurationException("can't build Listener object, missing conf:Listener element?");
+                            child=XMLHelper::getFirstChildElement(SHAR,Listener);
+                            if (child) {
+                                xmltooling::auto_ptr_char type(child->getAttributeNS(NULL,_type));
+                                if (type.get())
+                                    plugtype=type.get();
+                            }
                         }
                     }
                 }
+                if (child) {
+                    log.info("building ListenerService of type %s...", plugtype.c_str());
+                    m_outer->m_listener = conf.ListenerServiceManager.newPlugin(plugtype.c_str(),child);
+                }
+                else {
+                    log.fatal("can't build ListenerService, missing conf:Listener element?");
+                    throw ConfigurationException("Can't build ListenerService, missing conf:Listener element?");
+                }
             }
 
             if (conf.isEnabled(SPConfig::Caching)) {
-                IPlugIn* plugin=NULL;
+                // TODO: This code's a mess, due to a very bad config layout for the caches...
+                // Needs rework with the new config file.
                 const DOMElement* container=conf.isEnabled(SPConfig::OutOfProcess) ? SHAR : SHIRE;
-                exts=saml::XML::getFirstChildElement(container,shibtarget::XML::SHIBTARGET_NS,SHIBT_L(MemorySessionCache));
-                if (exts) {
-                    log.info("building Session Cache of type %s...",shibtarget::XML::MemorySessionCacheType);
-                    plugin=shibConf.getPlugMgr().newPlugin(shibtarget::XML::MemorySessionCacheType,exts);
+                child=XMLHelper::getFirstChildElement(container,MemorySessionCache);
+                if (child) {
+                    log.info("building Session Cache of type %s...",MEMORY_SESSIONCACHE);
+                    plugin=shibConf.getPlugMgr().newPlugin(MEMORY_SESSIONCACHE,child);
                 }
                 else {
-                    exts=saml::XML::getFirstChildElement(container,shibtarget::XML::SHIBTARGET_NS,SHIBT_L(ODBCSessionCache));
-                    if (exts) {
-                        log.info("building Session Cache of type %s...",shibtarget::XML::ODBCSessionCacheType);
-                        plugin=shibConf.getPlugMgr().newPlugin(shibtarget::XML::ODBCSessionCacheType,exts);
+                    child=XMLHelper::getFirstChildElement(container,SessionCache);
+                    if (child) {
+                        xmltooling::auto_ptr_char type(child->getAttributeNS(NULL,_type));
+                        log.info("building Session Cache of type %s...",type.get());
+                        plugin=shibConf.getPlugMgr().newPlugin(type.get(),child);
                     }
                     else {
-                        exts=saml::XML::getFirstChildElement(container,shibtarget::XML::SHIBTARGET_NS,SHIBT_L(MySQLSessionCache));
-                        if (exts) {
-                            log.info("building Session Cache of type %s...",shibtarget::XML::MySQLSessionCacheType);
-                            plugin=shibConf.getPlugMgr().newPlugin(shibtarget::XML::MySQLSessionCacheType,exts);
-                        }
-                        else {
-                            exts=saml::XML::getFirstChildElement(container,shibtarget::XML::SHIBTARGET_NS,SHIBT_L(SessionCache));
-                            if (exts) {
-                                xmltooling::auto_ptr_char type(exts->getAttributeNS(NULL,SHIBT_L(type)));
-                                log.info("building Session Cache of type %s...",type.get());
-                                plugin=shibConf.getPlugMgr().newPlugin(type.get(),exts);
-                            }
-                            else {
-                                log.info("session cache not specified, building Session Cache of type %s...",shibtarget::XML::MemorySessionCacheType);
-                                plugin=shibConf.getPlugMgr().newPlugin(shibtarget::XML::MemorySessionCacheType,exts);
-                            }
-                        }
+                        log.info("custom SessionCache unspecified or no longer supported, building SessionCache of type %s...",MEMORY_SESSIONCACHE);
+                        plugin=shibConf.getPlugMgr().newPlugin(MEMORY_SESSIONCACHE,child);
                     }
                 }
                 if (plugin) {
@@ -1060,70 +1016,55 @@ void XMLConfigImpl::init(bool first)
                     else {
                         delete plugin;
                         log.fatal("plugin was not a Session Cache object");
-                        throw UnsupportedExtensionException("plugin was not a Session Cache object");
+                        throw UnknownExtensionException("plugin was not a Session Cache object");
                     }
                 }
                 
                 // Replay cache.
-                container=conf.isEnabled(SPConfig::OutOfProcess) ? SHAR : SHIRE;
-                exts=saml::XML::getFirstChildElement(container,shibtarget::XML::SHIBTARGET_NS,SHIBT_L(ODBCReplayCache));
-                if (exts) {
-                    log.info("building Replay Cache of type %s...",shibtarget::XML::ODBCReplayCacheType);
-                    m_outer->m_replayCache=IReplayCache::getInstance(shibtarget::XML::ODBCReplayCacheType,exts);
+                // TODO: switch to new cache interface
+                child=XMLHelper::getFirstChildElement(container,ReplayCache);
+                if (child) {
+                    xmltooling::auto_ptr_char type(child->getAttributeNS(NULL,_type));
+                    log.info("building ReplayCache of type %s...",type.get());
+                    m_outer->m_replayCache=IReplayCache::getInstance(type.get(),child);
                 }
                 else {
-                    exts=saml::XML::getFirstChildElement(container,shibtarget::XML::SHIBTARGET_NS,SHIBT_L(MySQLReplayCache));
-                    if (exts) {
-                        log.info("building Replay Cache of type %s...",shibtarget::XML::MySQLReplayCacheType);
-                        m_outer->m_replayCache=IReplayCache::getInstance(shibtarget::XML::MySQLReplayCacheType,exts);
-                    }
-                    else {
-                        exts=saml::XML::getFirstChildElement(container,shibtarget::XML::SHIBTARGET_NS,SHIBT_L(ReplayCache));
-                        if (exts) {
-                            xmltooling::auto_ptr_char type(exts->getAttributeNS(NULL,SHIBT_L(type)));
-                            log.info("building Replay Cache of type %s...",type.get());
-                            m_outer->m_replayCache=IReplayCache::getInstance(type.get(),exts);
-                        }
-                        else {
-                            // OpenSAML default provider.
-                            log.info("building default Replay Cache...");
-                            m_outer->m_replayCache=IReplayCache::getInstance();
-                        }
-                    }
+                    // OpenSAML default provider.
+                    log.info("custom ReplayCache unspecified or no longer supported, building default ReplayCache...");
+                    m_outer->m_replayCache=IReplayCache::getInstance();
                 }
             }
-        }
+        } // end of first-time-only stuff
         
-        // Back to the fully dynamic stuff...next up is the Request Mapper.
+        // Back to the fully dynamic stuff...next up is the RequestMapper.
         if (conf.isEnabled(SPConfig::RequestMapper)) {
-            const DOMElement* child=XMLHelper::getFirstChildElement(SHIRE,shibtarget::XML::SHIBTARGET_NS,SHIBT_L(RequestMapProvider));
+            child=XMLHelper::getFirstChildElement(SHIRE,RequestMapProvider);
             if (child) {
-                xmltooling::auto_ptr_char type(child->getAttributeNS(NULL,SHIBT_L(type)));
-                log.info("building Request Mapper of type %s...",type.get());
-                IPlugIn* plugin=shibConf.getPlugMgr().newPlugin(type.get(),child);
+                xmltooling::auto_ptr_char type(child->getAttributeNS(NULL,_type));
+                log.info("building RequestMapper of type %s...",type.get());
+                plugin=shibConf.getPlugMgr().newPlugin(type.get(),child);
                 if (plugin) {
                     IRequestMapper* reqmap=dynamic_cast<IRequestMapper*>(plugin);
                     if (reqmap)
                         m_requestMapper=reqmap;
                     else {
                         delete plugin;
-                        log.fatal("plugin was not a Request Mapper object");
-                        throw UnsupportedExtensionException("plugin was not a Request Mapper object");
+                        log.fatal("plugin was not a RequestMapper object");
+                        throw UnknownExtensionException("plugin was not a RequestMapper object");
                     }
                 }
             }
             else {
-                log.fatal("can't build Request Mapper object, missing conf:RequestMapProvider element?");
-                throw ConfigurationException("can't build Request Mapper object, missing conf:RequestMapProvider element?");
+                log.fatal("can't build RequestMapper, missing conf:RequestMapProvider element?");
+                throw ConfigurationException("can't build RequestMapper, missing conf:RequestMapProvider element?");
             }
         }
         
         // Now we load the credentials map.
         if (conf.isEnabled(SPConfig::Credentials)) {
             // Old format was to wrap it in a CredentialsProvider plugin, we're inlining that...
-            const DOMElement* child = XMLHelper::getFirstChildElement(ReloadableXMLFileImpl::m_root,shibtarget::XML::SHIBTARGET_NS,SHIBT_L(CredentialsProvider));
-            if (!child)
-                child = XMLHelper::getFirstChildElement(ReloadableXMLFileImpl::m_root,Credentials);
+            child = XMLHelper::getFirstChildElement(e,CredentialsProvider);
+            child = XMLHelper::getFirstChildElement(child ? child : e,Credentials);
             if (child) {
                 // Step down and process resolvers.
                 child=XMLHelper::getFirstChildElement(child);
@@ -1135,22 +1076,21 @@ void XMLConfigImpl::init(bool first)
                         continue;
                     }
                     
-                    string cr_type;
                     if (XMLString::equals(child->getLocalName(),FileResolver))
-                        cr_type=FILESYSTEM_CREDENTIAL_RESOLVER;
+                        plugtype=FILESYSTEM_CREDENTIAL_RESOLVER;
                     else {
-                        xmltooling::auto_ptr_char c(child->getAttributeNS(NULL,type));
-                        cr_type=c.get();
+                        xmltooling::auto_ptr_char c(child->getAttributeNS(NULL,_type));
+                        plugtype=c.get();
                     }
                     
-                    if (!cr_type.empty()) {
+                    if (!plugtype.empty()) {
                         try {
-                            CredentialResolver* plugin=
-                                XMLToolingConfig::getConfig().CredentialResolverManager.newPlugin(cr_type.c_str(),child);
-                            m_credResolverMap[id.get()] = plugin;
+                            CredentialResolver* cr=
+                                XMLToolingConfig::getConfig().CredentialResolverManager.newPlugin(plugtype.c_str(),child);
+                            m_credResolverMap[id.get()] = cr;
                         }
-                        catch (exception& e) {
-                            log.crit("failed to instantiate CredentialResolver (%s): %s", id.get(), e.what());
+                        catch (exception& ex) {
+                            log.crit("failed to instantiate CredentialResolver (%s): %s", id.get(), ex.what());
                         }
                     }
                     else {
@@ -1163,20 +1103,18 @@ void XMLConfigImpl::init(bool first)
         }
 
         // Now we load any attribute factories
-        DOMNodeList* nlist;
-        nlist=ReloadableXMLFileImpl::m_root->getElementsByTagNameNS(shibtarget::XML::SHIBTARGET_NS,SHIBT_L(AttributeFactory));
-        for (unsigned int i=0; nlist && i<nlist->getLength(); i++) {
-            xmltooling::auto_ptr_char type(static_cast<DOMElement*>(nlist->item(i))->getAttributeNS(NULL,SHIBT_L(type)));
+        child = XMLHelper::getFirstChildElement(e,AttributeFactory);
+        while (child) {
+            xmltooling::auto_ptr_char type(child->getAttributeNS(NULL,_type));
             log.info("building Attribute factory of type %s...",type.get());
             try {
-                IPlugIn* plugin=shibConf.getPlugMgr().newPlugin(type.get(),static_cast<DOMElement*>(nlist->item(i)));
+                plugin=shibConf.getPlugMgr().newPlugin(type.get(),child);
                 if (plugin) {
                     IAttributeFactory* fact=dynamic_cast<IAttributeFactory*>(plugin);
                     if (fact) {
                         m_attrFactories.push_back(fact);
                         ShibConfig::getConfig().regAttributeMapping(
-                            static_cast<DOMElement*>(nlist->item(i))->getAttributeNS(NULL,L(AttributeName)),
-                            fact
+                            child->getAttributeNS(NULL,Attribute::ATTRIBUTENAME_ATTRIB_NAME), fact
                             );
                     }
                     else {
@@ -1186,42 +1124,71 @@ void XMLConfigImpl::init(bool first)
                 }
             }
             catch (exception& ex) {
-                log.crit("error building Attribute factory: %s",ex.what());
+                log.crit("error building Attribute factory: %s", ex.what());
             }
+
+            child = XMLHelper::getNextSiblingElement(child,AttributeFactory);
         }
 
         // Load the default application. This actually has a fixed ID of "default". ;-)
-        const DOMElement* app=saml::XML::getFirstChildElement(
-            ReloadableXMLFileImpl::m_root,shibtarget::XML::SHIBTARGET_NS,SHIBT_L(Applications)
-            );
-        if (!app) {
+        child=XMLHelper::getFirstChildElement(e,Applications);
+        if (!child) {
             log.fatal("can't build default Application object, missing conf:Applications element?");
             throw ConfigurationException("can't build default Application object, missing conf:Applications element?");
         }
-        XMLApplication* defapp=new XMLApplication(m_outer,app);
+        XMLApplication* defapp=new XMLApplication(m_outer,child);
         m_appmap[defapp->getId()]=defapp;
         
         // Load any overrides.
-        nlist=app->getElementsByTagNameNS(shibtarget::XML::SHIBTARGET_NS,SHIBT_L(Application));
-        for (unsigned int j=0; nlist && j<nlist->getLength(); j++) {
-            auto_ptr<XMLApplication> iapp(new XMLApplication(m_outer,static_cast<DOMElement*>(nlist->item(j)),defapp));
+        child = XMLHelper::getFirstChildElement(child,Application);
+        while (child) {
+            auto_ptr<XMLApplication> iapp(new XMLApplication(m_outer,child,defapp));
             if (m_appmap.find(iapp->getId())!=m_appmap.end())
-                log.crit("found conf:Application element with duplicate Id attribute, ignoring it");
+                log.crit("found conf:Application element with duplicate Id attribute (%s), skipping it", iapp->getId());
             else
                 m_appmap[iapp->getId()]=iapp.release();
+
+            child = XMLHelper::getNextSiblingElement(child,Application);
         }
     }
-    catch (exception& e) {
-        log.errorStream() << "Error while loading SP configuration: " << e.what() << CategoryStream::ENDLINE;
-        throw ConfigurationException(e.what());
+    catch (exception&) {
+        this->~XMLConfigImpl();
+        throw;
+    }
+#ifndef _DEBUG
+    catch (...) {
+        this->~XMLConfigImpl();
+        throw;
     }
+#endif
 }
 
 XMLConfigImpl::~XMLConfigImpl()
 {
-    delete m_requestMapper;
     for_each(m_appmap.begin(),m_appmap.end(),xmltooling::cleanup_pair<string,IApplication>());
-    for_each(m_credResolverMap.begin(),m_credResolverMap.end(),xmltooling::cleanup_pair<string,CredentialResolver>());
     ShibConfig::getConfig().clearAttributeMappings();
     for_each(m_attrFactories.begin(),m_attrFactories.end(),xmltooling::cleanup<IAttributeFactory>());
+    for_each(m_credResolverMap.begin(),m_credResolverMap.end(),xmltooling::cleanup_pair<string,CredentialResolver>());
+    delete m_requestMapper;
+    if (m_document)
+        m_document->release();
+}
+
+pair<bool,DOMElement*> XMLConfig::load()
+{
+    // Load from source using base class.
+    pair<bool,DOMElement*> raw = ReloadableXMLFile::load();
+    
+    // If we own it, wrap it.
+    XercesJanitor<DOMDocument> docjanitor(raw.first ? raw.second->getOwnerDocument() : NULL);
+
+    XMLConfigImpl* impl = new XMLConfigImpl(raw.second,(m_impl==NULL),this);
+    
+    // If we held the document, transfer it to the impl. If we didn't, it's a no-op.
+    impl->setDocument(docjanitor.release());
+
+    delete m_impl;
+    m_impl = impl;
+
+    return make_pair(false,(DOMElement*)NULL);
 }
index 33accb9..ac959d7 100644 (file)
@@ -131,6 +131,9 @@ namespace shibtarget {
         IConfig* m_conf;
         IRequestMapper* m_mapper;
     };
+
+    static const XMLCh SessionInitiator[] =     UNICODE_LITERAL_16(S,e,s,s,i,o,n,I,n,i,t,i,a,t,o,r);
+    static const XMLCh DiagnosticService[] =    UNICODE_LITERAL_17(D,i,a,g,n,o,s,t,i,c,S,e,r,v,i,c,e);
 }
 
 
@@ -389,11 +392,11 @@ pair<bool,void*> ShibTarget::doHandler(void)
 
         if (XMLHelper::isNodeNamed(handler->getProperties()->getElement(),samlconstants::SAML20MD_NS,AssertionConsumerService::LOCAL_NAME))
             procState = "Session Creation Error";
-        else if (XMLHelper::isNodeNamed(handler->getProperties()->getElement(),shibtarget::XML::SHIBTARGET_NS,SHIBT_L(SessionInitiator)))
+        else if (XMLString::equals(handler->getProperties()->getElement()->getLocalName(),SessionInitiator))
             procState = "Session Initiator Error";
         else if (XMLHelper::isNodeNamed(handler->getProperties()->getElement(),samlconstants::SAML20MD_NS,SingleLogoutService::LOCAL_NAME))
             procState = "Session Termination Error";
-        else if (XMLHelper::isNodeNamed(handler->getProperties()->getElement(),shibtarget::XML::SHIBTARGET_NS,SHIBT_L(DiagnosticService)))
+        else if (XMLString::equals(handler->getProperties()->getElement()->getLocalName(),DiagnosticService))
             procState = "Diagnostics Error";
         else
             procState = "Extension Service Error";
index 3144e1a..1769593 100644 (file)
@@ -252,6 +252,14 @@ namespace shibtarget {
         virtual ~ISessionCache() {}
     };
 
+    #define MEMORY_SESSIONCACHE "edu.internet2.middleware.shibboleth.sp.provider.MemorySessionCacheProvider"
+    #define MYSQL_SESSIONCACHE  "edu.internet2.middleware.shibboleth.sp.provider.MySQLSessionCacheProvider"
+    #define ODBC_SESSIONCACHE   "edu.internet2.middleware.shibboleth.sp.provider.ODBCSessionCacheProvider"
+
+    #define MYSQL_REPLAYCACHE   "edu.internet2.middleware.shibboleth.sp.provider.MySQLReplayCacheProvider"
+    #define ODBC_REPLAYCACHE    "edu.internet2.middleware.shibboleth.sp.provider.ODBCReplayCacheProvider"
+
+
     /**
      * Interface to an access control plugin
      * 
@@ -265,6 +273,9 @@ namespace shibtarget {
         virtual ~IAccessControl() {}
     };
 
+    #define HTACCESS_ACCESSCONTROL  "edu.internet2.middleware.shibboleth.sp.apache.provider.htAccessControl"
+    #define XML_ACCESSCONTROL       "edu.internet2.middleware.shibboleth.sp.provider.XMLAccessControl"
+
     /**
      * Interface to a request mapping plugin
      * 
@@ -277,12 +288,14 @@ namespace shibtarget {
         virtual Settings getSettings(ShibTarget* st) const=0;
         virtual ~IRequestMapper() {}
     };
-    
-    struct SHIBTARGET_EXPORTS IConfig : public virtual saml::ILockable, public virtual shibsp::PropertySet, public virtual saml::IPlugIn
+
+    #define XML_REQUESTMAP_PROVIDER     "edu.internet2.middleware.shibboleth.sp.provider.XMLRequestMapProvider"
+    #define NATIVE_REQUESTMAP_PROVIDER  "edu.internet2.middleware.shibboleth.sp.provider.NativeRequestMapProvider"
+    #define LEGACY_REQUESTMAP_PROVIDER  "edu.internet2.middleware.shibboleth.target.provider.XMLRequestMap"
+
+    struct SHIBTARGET_EXPORTS IConfig : public virtual xmltooling::Lockable, public virtual shibsp::PropertySet, public virtual saml::IPlugIn
     {
-        // loads initial configuration
         virtual void init()=0;
-
         virtual shibsp::ListenerService* getListener() const=0;
         virtual ISessionCache* getSessionCache() const=0;
         virtual saml::IReplayCache* getReplayCache() const=0;
@@ -494,93 +507,6 @@ namespace shibtarget {
         friend class ShibTargetPriv;
     };
 
-    struct SHIBTARGET_EXPORTS XML
-    {
-        static const XMLCh SHIBTARGET_NS[];
-        static const XMLCh SHIBTARGET_SCHEMA_ID[];
-        static const XMLCh SAML2ASSERT_NS[];
-        static const XMLCh SAML2ASSERT_SCHEMA_ID[];
-        static const XMLCh SAML2META_NS[];
-        static const XMLCh SAML2META_SCHEMA_ID[];
-        static const XMLCh XMLENC_NS[];
-        static const XMLCh XMLENC_SCHEMA_ID[];
-    
-        // Session cache implementations
-        static const char MemorySessionCacheType[];
-        static const char MySQLSessionCacheType[];
-        static const char ODBCSessionCacheType[];
-        
-        // Replay cache implementations
-        static const char MySQLReplayCacheType[];
-        static const char ODBCReplayCacheType[];
-        
-        // Request mapping/settings implementations
-        static const char XMLRequestMapType[];      // portable XML-based map
-        static const char NativeRequestMapType[];   // Native web server command override of XML-based map
-        static const char LegacyRequestMapType[];   // older designation of XML map, hijacked by web server
-        
-        // Access control implementations
-        static const char htAccessControlType[];    // Apache-specific .htaccess authz module
-        static const char XMLAccessControlType[];   // Proprietary but portable XML authz syntax
-
-        struct SHIBTARGET_EXPORTS Literals
-        {
-            static const XMLCh AAPProvider[];
-            static const XMLCh acl[];
-            static const XMLCh AND[];
-            static const XMLCh applicationId[];
-            static const XMLCh Application[];
-            static const XMLCh Applications[];
-            static const XMLCh AttributeFactory[];
-            static const XMLCh config[];
-            static const XMLCh CredentialsProvider[];
-            static const XMLCh CredentialUse[];
-            static const XMLCh DiagnosticService[];
-            static const XMLCh echo[];
-            static const XMLCh Extensions[];
-            static const XMLCh fatal[];
-            static const XMLCh Global[];
-            static const XMLCh Implementation[];
-            static const XMLCh index[];
-            static const XMLCh InProcess[];
-            static const XMLCh isDefault[];
-            static const XMLCh Library[];
-            static const XMLCh Listener[];
-            static const XMLCh Local[];
-            static const XMLCh log[];
-            static const XMLCh logger[];
-            static const XMLCh MemorySessionCache[];
-            static const XMLCh MetadataProvider[];
-            static const XMLCh MySQLReplayCache[];
-            static const XMLCh MySQLSessionCache[];
-            static const XMLCh name[];
-            static const XMLCh Name[];
-            static const XMLCh NOT[];
-            static const XMLCh ODBCReplayCache[];
-            static const XMLCh ODBCSessionCache[];
-            static const XMLCh OR[];
-            static const XMLCh OutOfProcess[];
-            static const XMLCh path[];
-            static const XMLCh RelyingParty[];
-            static const XMLCh ReplayCache[];
-            static const XMLCh RequestMap[];
-            static const XMLCh RequestMapProvider[];
-            static const XMLCh require[];
-            static const XMLCh Rule[];
-            static const XMLCh SessionCache[];
-            static const XMLCh SessionInitiator[];
-            static const XMLCh SHAR[];
-            static const XMLCh ShibbolethTargetConfig[];
-            static const XMLCh SHIRE[];
-            static const XMLCh Signing[];
-            static const XMLCh SPConfig[];
-            static const XMLCh TCPListener[];
-            static const XMLCh TLS[];
-            static const XMLCh TrustProvider[];
-            static const XMLCh type[];
-            static const XMLCh UnixListener[];
-        };
-    };
 }
 
 #endif /* SHIB_TARGET_H */
index d60e7a1..d7de190 100644 (file)
                        >
                </File>
                <File
-                       RelativePath="XML.cpp"
-                       >
-               </File>
-               <File
                        RelativePath="XMLRequestMapper.cpp"
                        >
                </File>
index 68b6152..04bb224 100644 (file)
@@ -10,7 +10,6 @@ noinst_HEADERS = internal.h
 
 libshib_la_SOURCES = \
     Metadata.cpp \
-    ReloadableXMLFile.cpp \
     ShibConfig.cpp \
     ShibBrowserProfile.cpp \
     ScopedAttribute.cpp
diff --git a/shib/ReloadableXMLFile.cpp b/shib/ReloadableXMLFile.cpp
deleted file mode 100644 (file)
index 9dd6dd8..0000000
+++ /dev/null
@@ -1,180 +0,0 @@
-/*
- *  Copyright 2001-2005 Internet2
- * 
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/* ReloadableXMLFile.cpp - basic implementation of a reloadable XML config file
-
-   Scott Cantor
-   1/6/04
-
-   $History:$
-*/
-
-#include "internal.h"
-
-#include <sys/types.h>
-#include <sys/stat.h>
-
-#include <xercesc/framework/LocalFileInputSource.hpp>
-
-using namespace shibboleth;
-using namespace saml;
-using namespace log4cpp;
-using namespace std;
-
-ReloadableXMLFileImpl::ReloadableXMLFileImpl(const DOMElement* e) : m_doc(NULL), m_root(e) {}
-
-ReloadableXMLFileImpl::ReloadableXMLFileImpl(const char* pathname) : m_doc(NULL), m_root(NULL)
-{
-#ifdef _DEBUG
-    NDC ndc("ReloadableXMLFileImpl");
-#endif
-    Category& log=Category::getInstance(SHIB_LOGCAT".ReloadableXMLFileImpl");
-
-    saml::XML::Parser p;
-    try
-    {
-        //static XMLCh base[]={chLatin_f, chLatin_i, chLatin_l, chLatin_e, chColon, chForwardSlash, chForwardSlash, chForwardSlash, chNull};
-        auto_ptr_XMLCh widenit(pathname);
-        LocalFileInputSource src(widenit.get());
-        Wrapper4InputSource dsrc(&src,false);
-        m_doc=p.parse(dsrc);
-        m_root=m_doc->getDocumentElement();
-
-        log.infoStream() << "Loaded and parsed XML file (" << pathname << ")" << CategoryStream::ENDLINE;
-    }
-    catch (XMLException& e)
-    {
-        auto_ptr_char msg(e.getMessage());
-        log.errorStream() << "Xerces error while opening configuration file (" << pathname << "): " << msg.get() << CategoryStream::ENDLINE;
-        if (m_doc) {
-            m_doc->release();
-            m_doc=NULL;
-        }
-        throw MalformedException(msg.get());
-    }
-    catch (SAMLException& e)
-    {
-        log.errorStream() << "XML error while parsing configuration file (" << pathname << "): " << e.what() << CategoryStream::ENDLINE;
-        if (m_doc) {
-            m_doc->release();
-            m_doc=NULL;
-        }
-        throw;
-    }
-#ifndef _DEBUG
-    catch (...)
-    {
-        log.errorStream() << "Unexpected error while parsing configuration file (" << pathname << ")" << CategoryStream::ENDLINE;
-        if (m_doc) {
-            m_doc->release();
-            m_doc=NULL;
-        }
-        throw;
-    }
-#endif
-}
-
-ReloadableXMLFileImpl::~ReloadableXMLFileImpl()
-{
-    if (m_doc) {
-        m_doc->release();
-        m_doc=NULL;
-    }
-}
-
-ReloadableXMLFile::ReloadableXMLFile(const DOMElement* e) : m_root(e), m_impl(NULL), m_filestamp(0), m_lock(NULL)
-{
-    static const XMLCh uri[] = { chLatin_u, chLatin_r, chLatin_i, chNull };
-    const XMLCh* pathname=e->getAttributeNS(NULL,uri);
-    if (pathname && *pathname)
-    {
-        auto_ptr_char temp(pathname);
-        m_source=temp.get();
-
-#ifdef WIN32
-        struct _stat stat_buf;
-        if (_stat(m_source.c_str(), &stat_buf) == 0)
-#else
-        struct stat stat_buf;
-        if (stat(m_source.c_str(), &stat_buf) == 0)
-#endif
-            m_filestamp=stat_buf.st_mtime;
-        m_lock=xmltooling::RWLock::create();
-    }
-}
-
-void ReloadableXMLFile::lock()
-{
-    if (!m_lock)
-        return;
-        
-    m_lock->rdlock();
-
-    // Check if we need to refresh.
-#ifdef WIN32
-    struct _stat stat_buf;
-    if (_stat(m_source.c_str(), &stat_buf) == 0)
-#else
-    struct stat stat_buf;
-    if (stat(m_source.c_str(), &stat_buf) == 0)
-#endif
-    {
-        if (m_filestamp>0 && m_filestamp<stat_buf.st_mtime)
-        {
-            // Elevate lock and recheck.
-            m_lock->unlock();
-            m_lock->wrlock();
-            if (m_filestamp>0 && m_filestamp<stat_buf.st_mtime)
-            {
-                try
-                {
-                    // Update the timestamp regardless. No point in repeatedly trying.
-                    m_filestamp=stat_buf.st_mtime;
-                    ReloadableXMLFileImpl* new_config=newImplementation(m_source.c_str(),false);
-                    delete m_impl;
-                    m_impl=new_config;
-                    m_lock->unlock();
-                }
-                catch(SAMLException& e)
-                {
-                    m_lock->unlock();
-                    Category::getInstance(SHIB_LOGCAT".ReloadableXMLFile").error("failed to reload config file, sticking with what we have: %s", e.what());
-                }
-                catch(...)
-                {
-                    m_lock->unlock();
-                    Category::getInstance(SHIB_LOGCAT".ReloadableXMLFile").error("caught an unknown exception, sticking with what we have");
-                }
-            }
-            else
-            {
-                m_lock->unlock();
-            }
-            m_lock->rdlock();
-        }
-    }
-}
-
-ReloadableXMLFileImpl* ReloadableXMLFile::getImplementation() const
-{
-    if (!m_impl) {
-        if (m_source.empty())
-            m_impl=newImplementation(saml::XML::getFirstChildElement(m_root));
-        else
-            m_impl=newImplementation(m_source.c_str());
-    }
-    return m_impl;
-}
index 3f5460b..7feb755 100644 (file)
    $History:$
 */
 
-#include <time.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-
 #define SHIB_INSTANTIATE
-
 #include "internal.h"
 
+#include <ctime>
+#include <sys/types.h>
+#include <sys/stat.h>
 #include <openssl/err.h>
+#include <xmltooling/util/Threads.h>
 
 using namespace saml;
 using namespace shibboleth;
index 295e972..8926e18 100644 (file)
@@ -28,7 +28,6 @@
 #include <saml/saml2/metadata/Metadata.h>
 #include <saml/saml2/metadata/MetadataProvider.h>
 #include <xmltooling/security/TrustEngine.h>
-#include <xmltooling/util/Threads.h>
 
 #include <saml/saml.h>
 #undef SAML10_PROTOCOL_ENUM
@@ -160,47 +159,6 @@ namespace shibboleth
         // enables runtime and clients to access configuration
         static ShibConfig& getConfig();
     };
-
-    /* Helper classes for implementing reloadable XML-based config files
-       The ILockable interface will usually be inherited twice, once as
-       part of the external interface to clients and once as an implementation
-       detail of the reloading class below.
-     */
-    
-    class SHIB_EXPORTS ReloadableXMLFileImpl
-    {
-    public:
-        ReloadableXMLFileImpl(const char* pathname);
-        ReloadableXMLFileImpl(const DOMElement* pathname);
-        virtual ~ReloadableXMLFileImpl();
-        
-    protected:
-        DOMDocument* m_doc;
-        const DOMElement* m_root;
-    };
-
-    class SHIB_EXPORTS ReloadableXMLFile : protected virtual saml::ILockable
-    {
-    public:
-        ReloadableXMLFile(const DOMElement* e);
-        ~ReloadableXMLFile() { delete m_lock; delete m_impl; }
-
-        virtual void lock();
-        virtual void unlock() { if (m_lock) m_lock->unlock(); }
-
-        ReloadableXMLFileImpl* getImplementation() const;
-
-    protected:
-        virtual ReloadableXMLFileImpl* newImplementation(const char* pathname, bool first=true) const=0;
-        virtual ReloadableXMLFileImpl* newImplementation(const DOMElement* e, bool first=true) const=0;
-        mutable ReloadableXMLFileImpl* m_impl;
-        
-    private:
-        const DOMElement* m_root;
-        std::string m_source;
-        time_t m_filestamp;
-        xmltooling::RWLock* m_lock;
-    };
 }
 
 #endif
index cc0df45..2fc3e61 100644 (file)
                        >
                </File>
                <File
-                       RelativePath="ReloadableXMLFile.cpp"
-                       >
-               </File>
-               <File
                        RelativePath="resource.h"
                        >
                </File>
index c98c17a..b381763 100644 (file)
@@ -41,6 +41,21 @@ const XMLCh shibspconstants::SHIBMD_NS[] = // urn:mace:shibboleth:metadata:1.0
 \r
 const XMLCh shibspconstants::SHIBMD_PREFIX[] = UNICODE_LITERAL_6(s,h,i,b,m,d);\r
 \r
+const XMLCh shibspconstants::SHIB2SPCONFIG_NS[] = // urn:mace:shibboleth:sp:config:2.0\r
+{ chLatin_u, chLatin_r, chLatin_n, chColon, chLatin_m, chLatin_a, chLatin_c, chLatin_e, chColon,\r
+  chLatin_s, chLatin_h, chLatin_i, chLatin_b, chLatin_b, chLatin_o, chLatin_l, chLatin_e, chLatin_t, chLatin_h, chColon,\r
+  chLatin_s, chLatin_p, chColon, chLatin_c, chLatin_o, chLatin_n, chLatin_f, chLatin_i, chLatin_g, chColon,\r
+  chDigit_2, chPeriod, chDigit_0, chNull\r
+};\r
+\r
+const XMLCh shibspconstants::SHIB1SPCONFIG_NS[] = // urn:mace:shibboleth:target:config:1.0\r
+{ chLatin_u, chLatin_r, chLatin_n, chColon, chLatin_m, chLatin_a, chLatin_c, chLatin_e, chColon,\r
+  chLatin_s, chLatin_h, chLatin_i, chLatin_b, chLatin_b, chLatin_o, chLatin_l, chLatin_e, chLatin_t, chLatin_h, chColon,\r
+  chLatin_t, chLatin_a, chLatin_r, chLatin_g, chLatin_e, chLatin_t, chColon,\r
+  chLatin_c, chLatin_o, chLatin_n, chLatin_f, chLatin_i, chLatin_g, chColon,\r
+  chDigit_1, chPeriod, chDigit_0, chNull\r
+};\r
+\r
 const XMLCh shibspconstants::SHIB1_ATTRIBUTE_NAMESPACE_URI[] = // urn:mace:shibboleth:1.0:attributeNamespace:uri\r
 { chLatin_u, chLatin_r, chLatin_n, chColon, chLatin_m, chLatin_a, chLatin_c, chLatin_e, chColon,\r
   chLatin_s, chLatin_h, chLatin_i, chLatin_b, chLatin_b, chLatin_o, chLatin_l, chLatin_e, chLatin_t, chLatin_h, chColon,\r
index 8c04d80..e2f12a3 100644 (file)
@@ -37,6 +37,12 @@ namespace shibspconstants {
     /** Shibboleth Metadata QName prefix ("shibmd") */
     extern SHIBSP_API const XMLCh SHIBMD_PREFIX[];
 
+    /** Shibboleth 2.0 SP configuration namespace ("urn:mace:shibboleth:sp:config:2.0") */
+    extern SHIBSP_API const XMLCh SHIB2SPCONFIG_NS[];
+
+    /** Shibboleth 1.x "target" (SP) configuration namespace ("urn:mace:shibboleth:target:config:1.0") */
+    extern SHIBSP_API const XMLCh SHIB1SPCONFIG_NS[];
+    
     /** Shibboleth 1.x Protocol Enumeration constant ("urn:mace:shibboleth:1.0") */
     extern SHIBSP_API const XMLCh SHIB1_PROTOCOL_ENUM[];
 
index de8051a..deab14a 100644 (file)
@@ -22,6 +22,7 @@
 #include <fstream>
 #include <shib-target/shib-target.h>
 
+#include <shibsp/exceptions.h>
 #include <shibsp/SPConfig.h>
 
 using namespace shibsp;
@@ -90,11 +91,11 @@ int main(int argc,char* argv[])
         auto_ptr_XMLCh recip(r_param);
 
         IConfig* ini=ShibTargetConfig::getConfig().getINI();
-        Locker locker(ini);
+        xmltooling::Locker locker(ini);
 
         const IApplication* app=ini->getApplication(a_param);
         if (!app) {
-            throw SAMLException("Unable to locate application for new session, deleted?");
+            throw ConfigurationException("Unable to locate application for new session, deleted?");
         }
 
         SAMLBrowserProfile::BrowserProfileResponse bpr=
@@ -103,8 +104,8 @@ int main(int argc,char* argv[])
         cout << "Success!" << endl;
         bpr.clear();
     }
-    catch(SAMLException& e) {
-        cerr << "caught a SAML exception: " << e << endl;
+    catch(exception& e) {
+        cerr << "caught an exception: " << e.what() << endl;
     }
 
     conf.shutdown();
index e5bd7d6..17692d8 100644 (file)
@@ -81,8 +81,11 @@ int main(int argc,char* argv[])
     if (!conf.init(path) || !conf.load(config))
         return -10;
 
+    IConfig* ini=ShibTargetConfig::getConfig().getINI();
+    xmltooling::Locker locker(ini);
+
     try {
-        const IApplication* app=conf.getINI()->getApplication(a_param);
+        const IApplication* app=ini->getApplication(a_param);
         if (!app)
             throw SAMLException("specified <Application> section not found in configuration");
 
index 4fc18f5..5c4b9e4 100644 (file)
@@ -119,10 +119,10 @@ namespace {
     #pragma warning( disable : 4250 )
 #endif
 
-    class XMLAAP : public IAAP, public xmltooling::ReloadableXMLFile
+    class XMLAAP : public IAAP, public ReloadableXMLFile
     {
     public:
-        XMLAAP(const DOMElement* e) : xmltooling::ReloadableXMLFile(e), m_impl(NULL) {}
+        XMLAAP(const DOMElement* e) : ReloadableXMLFile(e), m_impl(NULL) {}
         ~XMLAAP() {
             delete m_impl;
         }
@@ -169,7 +169,7 @@ IPlugIn* XMLAAPFactory(const DOMElement* e)
 pair<bool,DOMElement*> XMLAAP::load()
 {
     // Load from source using base class.
-    pair<bool,DOMElement*> raw = xmltooling::ReloadableXMLFile::load();
+    pair<bool,DOMElement*> raw = ReloadableXMLFile::load();
     
     // If we own it, wrap it.
     XercesJanitor<DOMDocument> docjanitor(raw.first ? raw.second->getOwnerDocument() : NULL);
index d623e41..9d1fbb0 100644 (file)
@@ -74,10 +74,10 @@ namespace {
     #pragma warning( disable : 4250 )
 #endif
 
-    class XMLAccessControl : public IAccessControl, public xmltooling::ReloadableXMLFile
+    class XMLAccessControl : public IAccessControl, public ReloadableXMLFile
     {
     public:
-        XMLAccessControl(const DOMElement* e) : xmltooling::ReloadableXMLFile(e), m_rootAuthz(NULL) {
+        XMLAccessControl(const DOMElement* e) : ReloadableXMLFile(e), m_rootAuthz(NULL) {
             load(); // guarantees an exception or the policy is loaded
         }
         
@@ -98,12 +98,12 @@ namespace {
     #pragma warning( pop )
 #endif
 
-    static const XMLCh AccessControl[] = UNICODE_LITERAL_13(A,c,c,e,s,s,C,o,n,t,r,o,l);
-    static const XMLCh require[] = UNICODE_LITERAL_7(r,e,q,u,i,r,e);
-    static const XMLCh NOT[] = UNICODE_LITERAL_3(N,O,T);
-    static const XMLCh AND[] = UNICODE_LITERAL_3(A,N,D);
-    static const XMLCh OR[] = UNICODE_LITERAL_2(O,R);
-    static const XMLCh _Rule[] = UNICODE_LITERAL_4(R,u,l,e);
+    static const XMLCh AccessControl[] =    UNICODE_LITERAL_13(A,c,c,e,s,s,C,o,n,t,r,o,l);
+    static const XMLCh require[] =          UNICODE_LITERAL_7(r,e,q,u,i,r,e);
+    static const XMLCh NOT[] =              UNICODE_LITERAL_3(N,O,T);
+    static const XMLCh AND[] =              UNICODE_LITERAL_3(A,N,D);
+    static const XMLCh OR[] =               UNICODE_LITERAL_2(O,R);
+    static const XMLCh _Rule[] =            UNICODE_LITERAL_4(R,u,l,e);
 }
 
 IPlugIn* XMLAccessControlFactory(const DOMElement* e)
index 637fef9..d3b5b49 100644 (file)
@@ -49,7 +49,7 @@ extern "C" int XML_EXPORTS saml_extension_init(void*)
     conf.getPlugMgr().regFactory("edu.internet2.middleware.shibboleth.common.provider.TargetedIDFactory",&TargetedIDFactory);
     conf.getPlugMgr().regFactory("edu.internet2.middleware.shibboleth.aap.provider.XMLAAP",&XMLAAPFactory);
     conf.getPlugMgr().regFactory("edu.internet2.middleware.shibboleth.target.provider.XMLAAP",&XMLAAPFactory);
-    conf.getPlugMgr().regFactory(shibtarget::XML::XMLAccessControlType,&XMLAccessControlFactory);
+    conf.getPlugMgr().regFactory(XML_ACCESSCONTROL,&XMLAccessControlFactory);
 
     return 0;
 }
@@ -61,5 +61,5 @@ extern "C" void XML_EXPORTS saml_extension_term()
     conf.getPlugMgr().unregFactory("edu.internet2.middleware.shibboleth.common.provider.TargetedIDFactory");
     conf.getPlugMgr().unregFactory("edu.internet2.middleware.shibboleth.aap.provider.XMLAAP");
     conf.getPlugMgr().unregFactory("edu.internet2.middleware.shibboleth.target.provider.XMLAAP");
-    conf.getPlugMgr().unregFactory(shibtarget::XML::XMLAccessControlType);
+    conf.getPlugMgr().unregFactory(XML_ACCESSCONTROL);
 }