SSPCPP-616 - clean up concatenated string literals
[shibboleth/cpp-sp.git] / shibsp / binding / impl / ArtifactResolver.cpp
index 840929e..edff5c5 100644 (file)
@@ -113,7 +113,7 @@ saml1p::Response* ArtifactResolver::resolve(
             response = client.receiveSAML();
         }
         catch (std::exception& ex) {
-            Category::getInstance(SHIBSP_LOGCAT".ArtifactResolver").error("exception resolving SAML 1.x artifact(s): %s", ex.what());
+            Category::getInstance(SHIBSP_LOGCAT ".ArtifactResolver").error("exception resolving SAML 1.x artifact(s): %s", ex.what());
             soaper.reset();
         }
     }
@@ -140,7 +140,7 @@ ArtifactResponse* ArtifactResolver::resolve(
     opensaml::SecurityPolicy& policy
     ) const
 {
-    Category& log = Category::getInstance(SHIBSP_LOGCAT".ArtifactResolver");
+    Category& log = Category::getInstance(SHIBSP_LOGCAT ".ArtifactResolver");
 
     MetadataCredentialCriteria mcc(ssoDescriptor);
     shibsp::SecurityPolicy& sppolicy = dynamic_cast<shibsp::SecurityPolicy&>(policy);
@@ -162,6 +162,9 @@ ArtifactResponse* ArtifactResolver::resolve(
         ep_end = ep_start + 1;
     }
 
+    const PropertySet* rp = sppolicy.getApplication().getRelyingParty(dynamic_cast<const EntityDescriptor*>(ssoDescriptor.getParent()));
+    pair<bool,bool> artifactByFilesystem = rp->getBool("artifactByFilesystem");
+
     for (vector<ArtifactResolutionService*>::const_iterator ep = ep_start; !response && ep != ep_end; ++ep) {
         try {
             if (XMLString::equals((*ep)->getBinding(), binding.get())) {
@@ -170,7 +173,7 @@ ArtifactResponse* ArtifactResolver::resolve(
                 ArtifactResolve* request = ArtifactResolveBuilder::buildArtifactResolve();
                 Issuer* iss = IssuerBuilder::buildIssuer();
                 request->setIssuer(iss);
-                iss->setName(sppolicy.getApplication().getRelyingParty(dynamic_cast<EntityDescriptor*>(ssoDescriptor.getParent()))->getXMLString("entityID").second);
+                iss->setName(rp->getXMLString("entityID").second);
                 auto_ptr_XMLCh artbuf(artifact.encode().c_str());
                 Artifact* a = ArtifactBuilder::buildArtifact();
                 a->setArtifact(artbuf.get());
@@ -184,7 +187,7 @@ ArtifactResponse* ArtifactResolver::resolve(
                     break;
                 }
             }
-            else if (XMLString::equals((*ep)->getBinding(), shibspconstants::SHIB2_BINDING_FILE)) {
+            else if (artifactByFilesystem.first && artifactByFilesystem.second && XMLString::equals((*ep)->getBinding(), shibspconstants::SHIB2_BINDING_FILE)) {
                 // This implements a resolution process against the local file system for custom integration needs.
                 // The local filesystem is presumed to be "secure" so that unsigned, unencrypted responses are acceptable.
                 // The binding here is not SOAP, but rather REST-like, with the base location used to construct a filename
@@ -197,7 +200,7 @@ ArtifactResponse* ArtifactResolver::resolve(
                         loc = loc.substr(7);
                     XMLToolingConfig::getConfig().getPathResolver()->resolve(loc, PathResolver::XMLTOOLING_RUN_FILE);
                     loc += '/' + SAMLArtifact::toHex(artifact.getMessageHandle());
-                    ifstream in(loc);
+                    ifstream in(loc.c_str());
                     if (in) {
                         auto_ptr<XMLObject> xmlObject;
                         try {
@@ -205,14 +208,10 @@ ArtifactResponse* ArtifactResolver::resolve(
                             XercesJanitor<DOMDocument> docjanitor(doc);
 
                             if (log.isDebugEnabled()) {
-#ifdef XMLTOOLING_LOG4SHIB
-                                log.debugStream() << "received XML:\n" << *(doc->getDocumentElement()) << logging::eol;
-#else
                                 string buf;
                                 XMLHelper::serialize(doc->getDocumentElement(), buf);
                                 log.debugStream() << "received XML:\n" << buf << logging::eol;
-#endif
-    }
+                            }
                             xmlObject.reset(XMLObjectBuilder::buildOneFromElement(doc->getDocumentElement(), true));
                             docjanitor.release();
                         }