ArtifactMap support.
authorcantor <cantor@cb58f699-b61c-0410-a6fe-9272a202ed29>
Fri, 2 Mar 2007 05:04:30 +0000 (05:04 +0000)
committercantor <cantor@cb58f699-b61c-0410-a6fe-9272a202ed29>
Fri, 2 Mar 2007 05:04:30 +0000 (05:04 +0000)
git-svn-id: https://svn.middleware.georgetown.edu/cpp-sp/trunk@2182 cb58f699-b61c-0410-a6fe-9272a202ed29

configs/shibboleth.xml.in
schemas/shibboleth-spconfig-2.0.xsd
shibsp/impl/XMLServiceProvider.cpp

index 0eac855..410552c 100644 (file)
                
                <!-- <TCPListener address="127.0.0.1" port="12345" acl="127.0.0.1"/> -->
                
+
                <StorageService type="Memory" id="memory" cleanupInterval="900"/>
+               <SessionCache type="StorageService" StorageService="memory" cacheTimeout="3600"/>
+               <ReplayCache StorageService="memory"/>
+               <ArtifactMap artifactTTL="180"/>
 
                <!--
                <StorageService type="ODBC" id="db" cleanupInterval="900">
                        DRIVER=drivername;SERVER=dbserver;UID=shibboleth;PWD=password;DATABASE=shibboleth;APP=Shibboleth
                        </ConnectionString>
                </StorageService>
+               <SessionCache type="StorageService" StorageService="db" cacheTimeout="3600"/>
+               <ReplayCache StorageService="db"/>
+               <ArtifactMap StorageService="db" artifactTTL="180"/>
                -->
-               
-               <SessionCache type="StorageService" StorageService="memory" cacheTimeout="3600"/>
-               <ReplayCache StorageService="memory"/>
-               
        </OutOfProcess>
     
        <!-- The InProcess section pertains to components that support transient process pools like most web servers. -->
index 4040c10..ec7247a 100644 (file)
@@ -90,7 +90,7 @@
                                        <sequence>\r
                                                <any namespace="##any" processContents="lax" minOccurs="0" maxOccurs="unbounded"/>\r
                                        </sequence>\r
-                                       <attribute name="id" type="conf:string" use="required"/>\r
+                                       <attribute name="id" type="ID" use="required"/>\r
                                        <attribute name="cleanupInterval" type="unsignedInt" default="900"/>\r
                                        <anyAttribute namespace="##any" processContents="lax"/>\r
                                </restriction>\r
                                        <sequence>\r
                                                <any namespace="##any" processContents="lax" minOccurs="0" maxOccurs="unbounded"/>\r
                                        </sequence>\r
+                                       <attribute name="StorageService" type="IDREF"/>\r
                                        <attribute name="cacheTimeout" type="unsignedInt" default="28800"/>\r
                                        <anyAttribute namespace="##any" processContents="lax"/>\r
                                </restriction>\r
        \r
        <element name="ReplayCache">
                <annotation>\r
-                       <documentation>Ties ReplayCache to custom StorageService</documentation>\r
+                       <documentation>Ties ReplayCache to custom StorageService</documentation>\r
                </annotation>\r
-               <complexType>
-                       <sequence/>\r
-                       <attribute name="StorageService" type="conf:string" use="required"/>
-               </complexType>
+               <sequence/>\r
+               <attribute name="StorageService" type="IDREF" use="required"/>\r
+       </element>
+       \r
+       <element name="ArtifactMap">
+               <annotation>\r
+                       <documentation>Customizes an ArtifactMap</documentation>\r
+               </annotation>\r
+               <sequence/>
+               <attribute name="StorageService" type="IDREF"/>
+               <attribute name="context" type="conf:string"/>
+               <attribute name="artifactTTL" type="unsignedInt" default="180"/>
        </element>\r
        \r
        <element name="OutOfProcess">\r
                                </choice>
                                <element ref="conf:StorageService" minOccurs="0" maxOccurs="unbounded"/>
                                <element ref="conf:SessionCache" minOccurs="0"/>
-                               <element ref="conf:ReplayCache" minOccurs="0"/>
+                               <element ref="conf:ReplayCache" minOccurs="0"/>\r
+                               <element ref="conf:ArtifactMap" minOccurs="0"/>
                                <any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded"/>
                        </sequence>
                        <attribute name="logger" type="anyURI"/>
index dd00d12..33d540c 100644 (file)
@@ -42,6 +42,7 @@
 #include <log4cpp/Category.hh>\r
 #include <log4cpp/PropertyConfigurator.hh>\r
 #include <saml/SAMLConfig.h>\r
+#include <saml/binding/ArtifactMap.h>\r
 #include <saml/saml1/core/Assertions.h>\r
 #include <saml/saml2/metadata/ChainingMetadataProvider.h>\r
 #include <xmltooling/XMLToolingConfig.h>\r
@@ -216,6 +217,7 @@ namespace {
             delete m_listener;\r
             delete m_tranLog;\r
             XMLToolingConfig::getConfig().setReplayCache(NULL);\r
+            SAMLConfig::getConfig().setArtifactMap(NULL);\r
             for_each(m_storage.begin(), m_storage.end(), cleanup_pair<string,StorageService>());\r
         }\r
 \r
@@ -308,6 +310,7 @@ namespace {
 \r
     static const XMLCh _Application[] =         UNICODE_LITERAL_11(A,p,p,l,i,c,a,t,i,o,n);\r
     static const XMLCh Applications[] =         UNICODE_LITERAL_12(A,p,p,l,i,c,a,t,i,o,n,s);\r
+    static const XMLCh _ArtifactMap[] =         UNICODE_LITERAL_11(A,r,t,i,f,a,c,t,M,a,p);\r
     static const XMLCh _AttributeResolver[] =   UNICODE_LITERAL_17(A,t,t,r,i,b,u,t,e,R,e,s,o,l,v,e,r);\r
     static const XMLCh Credentials[] =          UNICODE_LITERAL_11(C,r,e,d,e,n,t,i,a,l,s);\r
     static const XMLCh CredentialUse[] =        UNICODE_LITERAL_13(C,r,e,d,e,n,t,i,a,l,U,s,e);\r
@@ -320,6 +323,9 @@ namespace {
     static const XMLCh Listener[] =             UNICODE_LITERAL_8(L,i,s,t,e,n,e,r);\r
     static const XMLCh logger[] =               UNICODE_LITERAL_6(l,o,g,g,e,r);\r
     static const XMLCh MemoryListener[] =       UNICODE_LITERAL_14(M,e,m,o,r,y,L,i,s,t,e,n,e,r);\r
+    static const XMLCh _MetadataProvider[] =    UNICODE_LITERAL_16(M,e,t,a,d,a,t,a,P,r,o,v,i,d,e,r);\r
+    static const XMLCh OutOfProcess[] =         UNICODE_LITERAL_12(O,u,t,O,f,P,r,o,c,e,s,s);\r
+    static const XMLCh _path[] =                UNICODE_LITERAL_4(p,a,t,h);\r
     static const XMLCh Policy[] =               UNICODE_LITERAL_6(P,o,l,i,c,y);\r
     static const XMLCh RelyingParty[] =         UNICODE_LITERAL_12(R,e,l,y,i,n,g,P,a,r,t,y);\r
     static const XMLCh _ReplayCache[] =         UNICODE_LITERAL_11(R,e,p,l,a,y,C,a,c,h,e);\r
@@ -329,13 +335,10 @@ namespace {
     static const XMLCh _SessionCache[] =        UNICODE_LITERAL_12(S,e,s,s,i,o,n,C,a,c,h,e);\r
     static const XMLCh SessionInitiator[] =     UNICODE_LITERAL_16(S,e,s,s,i,o,n,I,n,i,t,i,a,t,o,r);\r
     static const XMLCh _StorageService[] =      UNICODE_LITERAL_14(S,t,o,r,a,g,e,S,e,r,v,i,c,e);\r
-    static const XMLCh OutOfProcess[] =         UNICODE_LITERAL_12(O,u,t,O,f,P,r,o,c,e,s,s);\r
     static const XMLCh TCPListener[] =          UNICODE_LITERAL_11(T,C,P,L,i,s,t,e,n,e,r);\r
     static const XMLCh _TrustEngine[] =         UNICODE_LITERAL_11(T,r,u,s,t,E,n,g,i,n,e);\r
-    static const XMLCh UnixListener[] =         UNICODE_LITERAL_12(U,n,i,x,L,i,s,t,e,n,e,r);\r
-    static const XMLCh _MetadataProvider[] =    UNICODE_LITERAL_16(M,e,t,a,d,a,t,a,P,r,o,v,i,d,e,r);\r
-    static const XMLCh _path[] =                UNICODE_LITERAL_4(p,a,t,h);\r
     static const XMLCh _type[] =                UNICODE_LITERAL_4(t,y,p,e);\r
+    static const XMLCh UnixListener[] =         UNICODE_LITERAL_12(U,n,i,x,L,i,s,t,e,n,e,r);\r
 \r
     class SHIBSP_DLLLOCAL PolicyNodeFilter : public DOMNodeFilter\r
     {\r
@@ -859,6 +862,7 @@ short XMLConfigImpl::acceptNode(const DOMNode* node) const
         return FILTER_ACCEPT;\r
     const XMLCh* name=node->getLocalName();\r
     if (XMLString::equals(name,Applications) ||\r
+        XMLString::equals(name,_ArtifactMap) ||\r
         XMLString::equals(name,Credentials) ||\r
         XMLString::equals(name,Extensions::LOCAL_NAME) ||\r
         XMLString::equals(name,Implementation) ||\r
@@ -1054,6 +1058,20 @@ XMLConfigImpl::XMLConfigImpl(const DOMElement* e, bool first, const XMLConfig* o
                         replaySS = m_outer->m_storage[inmemID];\r
                     }\r
                     xmlConf.setReplayCache(new ReplayCache(replaySS));\r
+                    \r
+                    // ArtifactMap\r
+                    child=XMLHelper::getFirstChildElement(SHAR,_ArtifactMap);\r
+                    if (child) {\r
+                        auto_ptr_char ssid(child->getAttributeNS(NULL,_StorageService));\r
+                        if (ssid.get() && *ssid.get() && m_outer->m_storage.count(ssid.get())) {\r
+                            log.info("building ArtifactMap on top of StorageService (%s)...", ssid.get());\r
+                            samlConf.setArtifactMap(new ArtifactMap(child, m_outer->m_storage[ssid.get()]));\r
+                        }\r
+                    }\r
+                    if (samlConf.getArtifactMap()==NULL) {\r
+                        log.info("building in-memory ArtifactMap...");\r
+                        samlConf.setArtifactMap(new ArtifactMap(child));\r
+                    }\r
                 }\r
                 else {\r
                     log.info("building in-process SessionCache of type %s...",REMOTED_SESSION_CACHE);\r