Add option to use redirection for handler errors, capture relay state when propagatin...
[shibboleth/sp.git] / shibsp / handler / impl / AbstractHandler.cpp
index 1965cc8..7808ddc 100644 (file)
 #include "SPRequest.h"
 #include "handler/AbstractHandler.h"
 
-#include <saml/SAMLConfig.h>
-#include <saml/binding/URLEncoder.h>
 #include <saml/saml1/core/Protocols.h>
 #include <saml/saml2/core/Protocols.h>
 #include <saml/util/SAMLConstants.h>
+#include <xmltooling/XMLToolingConfig.h>
+#include <xmltooling/util/URLEncoder.h>
 
 using namespace shibsp;
 using namespace samlconstants;
@@ -67,15 +67,15 @@ void AbstractHandler::checkError(const XMLObject* response) const
             if (code && !XMLString::equals(code,saml2p::StatusCode::SUCCESS)) {
                 FatalProfileException ex("SAML Response message contained an error.");
                 auto_ptr_char c1(code);
-                ex.addProperty("code", c1.get());
+                ex.addProperty("StatusCode", c1.get());
                 if (sc->getStatusCode()) {
                     code = sc->getStatusCode()->getValue();
                     auto_ptr_char c2(code);
-                    ex.addProperty("code2", c2.get());
+                    ex.addProperty("StatusCode2", c2.get());
                 }
                 if (status->getStatusMessage()) {
                     auto_ptr_char msg(status->getStatusMessage()->getMessage());
-                    ex.addProperty("message", msg.get());
+                    ex.addProperty("StatusMessage", msg.get());
                 }
             }
         }
@@ -89,15 +89,15 @@ void AbstractHandler::checkError(const XMLObject* response) const
             const QName* code = sc ? sc->getValue() : NULL;
             if (code && *code != saml1p::StatusCode::SUCCESS) {
                 FatalProfileException ex("SAML Response message contained an error.");
-                ex.addProperty("code", code->toString().c_str());
+                ex.addProperty("StatusCode", code->toString().c_str());
                 if (sc->getStatusCode()) {
                     code = sc->getStatusCode()->getValue();
                     if (code)
-                        ex.addProperty("code2", code->toString().c_str());
+                        ex.addProperty("StatusCode2", code->toString().c_str());
                 }
                 if (status->getStatusMessage()) {
                     auto_ptr_char msg(status->getStatusMessage()->getMessage());
-                    ex.addProperty("message", msg.get());
+                    ex.addProperty("StatusMessage", msg.get());
                 }
             }
         }
@@ -109,7 +109,7 @@ void AbstractHandler::recoverRelayState(HTTPRequest& httpRequest, string& relayS
     SPConfig& conf = SPConfig::getConfig();
     if (conf.isEnabled(SPConfig::OutOfProcess)) {
         // Out of process, we look for StorageService-backed state.
-        // TODO
+        // TODO: something like ss:SSID:key?
     }
     
     if (conf.isEnabled(SPConfig::InProcess)) {
@@ -122,7 +122,7 @@ void AbstractHandler::recoverRelayState(HTTPRequest& httpRequest, string& relayS
             if (state && *state) {
                 // URL-decode the value.
                 char* rscopy=strdup(state);
-                SAMLConfig::getConfig().getURLEncoder()->decode(rscopy);
+                XMLToolingConfig::getConfig().getURLEncoder()->decode(rscopy);
                 relayState = rscopy;
                 free(rscopy);