https://issues.shibboleth.net/jira/browse/SSPCPP-268
authorScott Cantor <cantor.2@osu.edu>
Wed, 25 Nov 2009 18:54:10 +0000 (18:54 +0000)
committerScott Cantor <cantor.2@osu.edu>
Wed, 25 Nov 2009 18:54:10 +0000 (18:54 +0000)
shibsp/handler/impl/SAML2ArtifactResolution.cpp

index 2321494..1ea7317 100644 (file)
@@ -111,14 +111,8 @@ namespace shibsp {
     private:
         pair<bool,long> processMessage(const Application& application, HTTPRequest& httpRequest, HTTPResponse& httpResponse) const;
 #ifndef SHIBSP_LITE
-        pair<bool,long> samlError(
-            const Application& app,
-            const ArtifactResolve& request,
-            HTTPResponse& httpResponse,
-            const EntityDescriptor* recipient,
-            const XMLCh* code,
-            const XMLCh* subcode=NULL,
-            const char* msg=NULL
+        pair<bool,long> emptyResponse(
+            const Application& app, const ArtifactResolve& request, HTTPResponse& httpResponse, const EntityDescriptor* recipient
             ) const;
 
         MessageEncoder* m_encoder;
@@ -316,7 +310,7 @@ pair<bool,long> SAML2ArtifactResolution::processMessage(const Application& appli
     try {
         auto_ptr_char artifact(req->getArtifact() ? req->getArtifact()->getArtifact() : NULL);
         if (!artifact.get() || !*artifact.get())
-            return samlError(application, *req, httpResponse, entity, StatusCode::REQUESTER, NULL, "Request did not contain an artifact to resolve.");
+            return emptyResponse(application, *req, httpResponse, entity);
         auto_ptr_char issuer(policy.getIssuer() ? policy.getIssuer()->getName() : NULL);
 
         m_log.info("resolving artifact (%s) for (%s)", artifact.get(), issuer.get() ? issuer.get() : "unknown");
@@ -327,7 +321,7 @@ pair<bool,long> SAML2ArtifactResolution::processMessage(const Application& appli
 
         if (!policy.isAuthenticated()) {
             m_log.error("request for artifact was unauthenticated, purging the artifact mapping");
-            return samlError(application, *req, httpResponse, entity, StatusCode::REQUESTER, StatusCode::AUTHN_FAILED, "Unable to authenticate request.");
+            return emptyResponse(application, *req, httpResponse, entity);
         }
 
         m_log.debug("artifact resolved, preparing response");
@@ -346,9 +340,9 @@ pair<bool,long> SAML2ArtifactResolution::processMessage(const Application& appli
         return make_pair(true,ret);
     }
     catch (exception& ex) {
-        // Trap localized errors in a SAML Response.
-        m_log.error("error processing artifact request, returning SAML error: %s", ex.what());
-        return samlError(application, *req, httpResponse, entity, StatusCode::RESPONDER, NULL, ex.what());
+        // Trap localized errors.
+        m_log.error("error processing artifact request: %s", ex.what());
+        return emptyResponse(application, *req, httpResponse, entity);
     }
 #else
     return make_pair(false,0L);
@@ -356,21 +350,15 @@ pair<bool,long> SAML2ArtifactResolution::processMessage(const Application& appli
 }
 
 #ifndef SHIBSP_LITE
-pair<bool,long> SAML2ArtifactResolution::samlError(
-    const Application& app,
-    const ArtifactResolve& request,
-    HTTPResponse& httpResponse,
-    const EntityDescriptor* recipient,
-    const XMLCh* code,
-    const XMLCh* subcode,
-    const char* msg
+pair<bool,long> SAML2ArtifactResolution::emptyResponse(
+    const Application& app, const ArtifactResolve& request, HTTPResponse& httpResponse, const EntityDescriptor* recipient
     ) const
 {
     auto_ptr<ArtifactResponse> resp(ArtifactResponseBuilder::buildArtifactResponse());
     resp->setInResponseTo(request.getID());
     Issuer* me = IssuerBuilder::buildIssuer();
     me->setName(app.getRelyingParty(recipient)->getXMLString("entityID").second);
-    fillStatus(*resp.get(), code, subcode, msg);
+    fillStatus(*resp.get(), StatusCode::SUCCESS);
     long ret = m_encoder->encode(httpResponse, resp.get(), NULL);
     resp.release();  // freed by encoder
     return make_pair(true,ret);