Move Shib constants to new lib, fixed symbol conflicts.
[shibboleth/cpp-sp.git] / test / shibtest.cpp
index 447439b..918eaa4 100644 (file)
  * limitations under the License.
  */
 
-#include "../shib-target/shib-target.h"
+#ifdef WIN32
+# define _CRT_NONSTDC_NO_DEPRECATE 1
+# define _CRT_SECURE_NO_DEPRECATE 1
+#endif
 
-using namespace std;
-using namespace saml;
-using namespace shibboleth;
+#include <shib-target/shib-target.h>
+#include <shibsp/SPConfig.h>
+#include <shibsp/SPConstants.h>
+
+using namespace shibsp;
 using namespace shibtarget;
+using namespace shibboleth;
+using namespace saml;
+using namespace std;
 
 int main(int argc,char* argv[])
 {
@@ -62,13 +70,13 @@ int main(int argc,char* argv[])
         a_param="default";
 
     ShibTargetConfig& conf=ShibTargetConfig::getConfig();
-    conf.setFeatures(
-        ShibTargetConfig::Metadata |
-        ShibTargetConfig::Trust |
-        ShibTargetConfig::Credentials |
-        ShibTargetConfig::AAP |
-        ShibTargetConfig::GlobalExtensions |
-        ShibTargetConfig::Caching
+    SPConfig::getConfig().setFeatures(
+        SPConfig::Metadata |
+        SPConfig::Trust |
+        SPConfig::Credentials |
+        SPConfig::AAP |
+        SPConfig::OutOfProcess |
+        SPConfig::Caching
         );
     if (!conf.init(path) || !conf.load(config))
         return -10;
@@ -90,7 +98,7 @@ int main(int argc,char* argv[])
                         new SAMLNameIdentifier(
                             handle.get(),
                             domain.get(),
-                            format.get() ? format.get() : Constants::SHIB_NAMEID_FORMAT_URI
+                            format.get() ? format.get() : shibspconstants::SHIB1_NAMEID_FORMAT_URI
                             )
                         ),
                     resource.get(),
@@ -127,17 +135,7 @@ int main(int argc,char* argv[])
                     throw TrustException("unable to verify signed response");
                 response = r.release();
             }
-            catch (SAMLException& e) {
-                // Check for shib:InvalidHandle error and propagate it out.
-                Iterator<saml::QName> codes=e.getCodes();
-                if (codes.size()>1) {
-                    const saml::QName& code=codes[1];
-                    if (!XMLString::compareString(code.getNamespaceURI(),shibboleth::Constants::SHIB_NS) &&
-                        !XMLString::compareString(code.getLocalName(), shibboleth::Constants::InvalidHandle)) {
-                        codes.reset();
-                        throw InvalidHandleException(e.what(),params(),codes);
-                    }
-                }
+            catch (SAMLException&) {
             }
         }
 
@@ -148,7 +146,7 @@ int main(int argc,char* argv[])
         Iterator<SAMLAssertion*> a=response->getAssertions();
         for (unsigned long c=0; c < a.size();) {
             try {
-                AAP::apply(app->getAAPProviders(),*(a[c]),AA);
+                AAP::apply(app->getAAPProviders(),*(a[c]),site);
                 c++;
             }
             catch (SAMLException&) {