Add AttributeFactory and DiagnosticService elements.
authorScott Cantor <cantor.2@osu.edu>
Sun, 1 May 2005 03:30:44 +0000 (03:30 +0000)
committerScott Cantor <cantor.2@osu.edu>
Sun, 1 May 2005 03:30:44 +0000 (03:30 +0000)
configs/shibboleth.xml.in
shib-target/XML.cpp
shib-target/shib-ini.cpp
shib-target/shib-sock.cpp
shib-target/shib-target.h

index 7b3473e..0425bd5 100644 (file)
             supported via the "urn:mace:shibboleth:sp:1.3:Logout" Binding value.
             -->
                        <md:SingleLogoutService Location="/Logout" Binding="urn:mace:shibboleth:sp:1.3:Logout"/>
+
+                       <!--
+                       Some internal debugging support (invoke with a query string "cmd" parameter).
+                       By default, access to log or config information is blocked, but a user can
+                       echo their own session data.
+                       -->
+                       <DiagnosticService Location="/Diag" Binding="urn:mace:shibboleth:sp:1.3:Diagnostics"
+                               echo="true" log="false" config="false"/>
             
         </Sessions>
 
         </Credentials>
     </CredentialsProvider>
 
+       <!-- Specialized attribute handling for cases with complex syntax. -->
+       <AttributeFactory AttributeName="urn:oid:1.3.6.1.4.1.5923.1.1.1.10"
+               type="edu.internet2.middleware.shibboleth.common.provider.TargetedIDFactory"/>
+
 </SPConfig>
 
index 835bc87..64673d0 100644 (file)
@@ -143,6 +143,9 @@ const XMLCh XML::Literals::AccessControl[] =
   chLatin_C, chLatin_o, chLatin_n, chLatin_t, chLatin_r, chLatin_o, chLatin_l, 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
@@ -160,6 +163,14 @@ const XMLCh XML::Literals::AssertionConsumerService[] =
   chLatin_S, chLatin_e, chLatin_r, chLatin_v, chLatin_i, chLatin_c, chLatin_e, 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
@@ -170,6 +181,14 @@ const XMLCh XML::Literals::CredentialUse[] =
   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 };
 
@@ -206,6 +225,9 @@ const XMLCh XML::Literals::Listener[] =
 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 };
 
index d2d5637..089e3e1 100644 (file)
@@ -147,6 +147,7 @@ namespace shibtarget {
         IRequestMapper* m_requestMapper;
         map<string,IApplication*> m_appmap;
         vector<ICredentials*> m_creds;
+        vector<IAttributeFactory*> m_attrFactories;
         
         // Provides filter to exclude special config elements.
         short acceptNode(const DOMNode* node) const;
@@ -629,6 +630,7 @@ short XMLApplication::acceptNode(const DOMNode* node) const
     if (!XMLString::compareString(name,SHIBT_L(Application)) ||
         !XMLString::compareString(name,SHIBT_L(AssertionConsumerService)) ||
         !XMLString::compareString(name,SHIBT_L(SingleLogoutService)) ||
+        !XMLString::compareString(name,SHIBT_L(DiagnosticService)) ||
         !XMLString::compareString(name,SHIBT_L(SessionInitiator)) ||
         !XMLString::compareString(name,SHIBT_L(AAPProvider)) ||
         !XMLString::compareString(name,SHIBT_L(CredentialUse)) ||
@@ -799,6 +801,7 @@ short XMLConfigImpl::acceptNode(const DOMNode* node) const
         return FILTER_ACCEPT;
     const XMLCh* name=node->getLocalName();
     if (!XMLString::compareString(name,SHIBT_L(Applications)) ||
+        !XMLString::compareString(name,SHIBT_L(AttributeFactory)) ||
         !XMLString::compareString(name,SHIBT_L(CredentialsProvider)) ||
         !XMLString::compareString(name,SHIBT_L(Extensions)) ||
         !XMLString::compareString(name,SHIBT_L(Implementation)) ||
@@ -1085,6 +1088,29 @@ void XMLConfigImpl::init(bool first)
             }
         }
 
+        // Now we load any attribute factories
+        nlist=ReloadableXMLFileImpl::m_root->getElementsByTagNameNS(shibtarget::XML::SHIBTARGET_NS,SHIBT_L(AttributeFactory));
+        for (int i=0; nlist && i<nlist->getLength(); i++) {
+            auto_ptr_char type(static_cast<DOMElement*>(nlist->item(i))->getAttributeNS(NULL,SHIBT_L(type)));
+            log.info("building Attribute factory of type %s...",type.get());
+            IPlugIn* plugin=shibConf.getPlugMgr().newPlugin(type.get(),static_cast<DOMElement*>(nlist->item(i)));
+            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
+                        );
+                }
+                else {
+                    delete plugin;
+                    log.fatal("plugin was not an Attribute factory");
+                    throw UnsupportedExtensionException("plugin was not an Attribute factory");
+                }
+            }
+        }
+
         // 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)
@@ -1098,8 +1124,8 @@ void XMLConfigImpl::init(bool first)
         
         // Load any overrides.
         nlist=app->getElementsByTagNameNS(shibtarget::XML::SHIBTARGET_NS,SHIBT_L(Application));
-        for (int i=0; nlist && i<nlist->getLength(); i++) {
-            XMLApplication* iapp=new XMLApplication(m_outer,m_creds,static_cast<DOMElement*>(nlist->item(i)),defapp);
+        for (int j=0; nlist && i<nlist->getLength(); j++) {
+            XMLApplication* iapp=new XMLApplication(m_outer,m_creds,static_cast<DOMElement*>(nlist->item(j)),defapp);
             if (m_appmap.find(iapp->getId())!=m_appmap.end()) {
                 log.fatal("found conf:Application element with duplicate Id attribute");
                 throw ConfigurationException("found conf:Application element with duplicate Id attribute");
@@ -1126,4 +1152,7 @@ XMLConfigImpl::~XMLConfigImpl()
         delete i->second;
     for (vector<ICredentials*>::iterator j=m_creds.begin(); j!=m_creds.end(); j++)
         delete (*j);
+    ShibConfig::getConfig().clearAttributeMappings();
+    for (vector<IAttributeFactory*>::iterator k=m_attrFactories.begin(); k!=m_attrFactories.end(); k++)
+        delete (*k);
 }
index 66f872c..a51eedc 100644 (file)
@@ -78,7 +78,6 @@ using namespace log4cpp;
 
 static const XMLCh address[] = { chLatin_a, chLatin_d, chLatin_d, chLatin_r, chLatin_e, chLatin_s, chLatin_s, chNull };
 static const XMLCh port[] = { chLatin_p, chLatin_o, chLatin_r, chLatin_t, chNull };
-static const XMLCh acl[] = { chLatin_a, chLatin_c, chLatin_l, chNull };
 
 class TCPListener : public IListener
 {
@@ -125,7 +124,7 @@ TCPListener::TCPListener(const DOMElement* e) : m_address("127.0.0.1"), m_port(1
             m_port=12345;
     }
     
-    tag=e->getAttributeNS(NULL,acl);
+    tag=e->getAttributeNS(NULL,SHIBT_L(acl));
     if (tag && *tag) {
         auto_ptr_char temp(tag);
         string sockacl=temp.get();
index 5054a3a..16055ac 100644 (file)
@@ -485,13 +485,18 @@ namespace shibtarget {
             static const XMLCh AAPProvider[];
             static const XMLCh AccessControl[];
             static const XMLCh AccessControlProvider[];
+            static const XMLCh acl[];
             static const XMLCh AND[];
             static const XMLCh applicationId[];
             static const XMLCh Application[];
             static const XMLCh Applications[];
             static const XMLCh AssertionConsumerService[];
+            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 FederationProvider[];
@@ -504,6 +509,7 @@ namespace shibtarget {
             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[];