Moved/renamed binding constants.
authorScott Cantor <cantor.2@osu.edu>
Fri, 13 Oct 2006 19:53:38 +0000 (19:53 +0000)
committerScott Cantor <cantor.2@osu.edu>
Fri, 13 Oct 2006 19:53:38 +0000 (19:53 +0000)
saml/binding/MessageDecoder.h
saml/binding/MessageEncoder.h
saml/binding/impl/MessageDecoder.cpp
saml/binding/impl/MessageEncoder.cpp
saml/util/SAMLConstants.cpp
saml/util/SAMLConstants.h
samltest/saml1/binding/SAML1ArtifactTest.h
samltest/saml1/binding/SAML1POSTTest.h
samltest/saml2/binding/SAML2ArtifactTest.h
samltest/saml2/binding/SAML2POSTTest.h

index 364d6a5..535dfc4 100644 (file)
@@ -254,21 +254,6 @@ namespace opensaml {
      * Registers MessageDecoder plugins into the runtime.
      */
     void SAML_API registerMessageDecoders();
-
-    /** MessageDecoder for SAML 1.x Browser/Artifact "binding" (really part of profile) */
-    #define SAML1_ARTIFACT_DECODER  "urn:oasis:names:tc:SAML:1.0:profiles:artifact-01"
-
-    /** MessageDecoder for SAML 1.x Browser/POST "binding" (really part of profile) */
-    #define SAML1_POST_DECODER  "urn:oasis:names:tc:SAML:1.0:profiles:browser-post"
-    
-    /** MessageDecoder for SAML 2.0 HTTP-Artifact binding */
-    #define SAML2_ARTIFACT_DECODER "urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Artifact"
-
-    /** MessageDecoder for SAML 2.0 HTTP-POST binding */
-    #define SAML2_POST_DECODER "urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST"
-
-    /** MessageDecoder for SAML 2.0 HTTP-Redirect binding */
-    #define SAML2_REDIRECT_DECODER "urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Redirect"
 };
 
 #endif /* __saml_decoder_h__ */
index 668049a..4d23033 100644 (file)
@@ -151,21 +151,6 @@ namespace opensaml {
      * Registers MessageEncoder plugins into the runtime.
      */
     void SAML_API registerMessageEncoders();
-
-    /** MessageEncoder for SAML 1.x Browser/Artifact "binding" (really part of profile) */
-    #define SAML1_ARTIFACT_ENCODER  "urn:oasis:names:tc:SAML:1.0:profiles:artifact-01"
-
-    /** MessageEncoder for SAML 1.x Browser/POST "binding" (really part of profile) */
-    #define SAML1_POST_ENCODER  "urn:oasis:names:tc:SAML:1.0:profiles:browser-post"
-    
-    /** MessageEncoder for SAML 2.0 HTTP-Artifact binding */
-    #define SAML2_ARTIFACT_ENCODER "urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Artifact"
-
-    /** MessageEncoder for SAML 2.0 HTTP-POST binding */
-    #define SAML2_POST_ENCODER "urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST"
-
-    /** MessageEncoder for SAML 2.0 HTTP-Redirect binding */
-    #define SAML2_REDIRECT_ENCODER "urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Redirect"
 };
 
 #endif /* __saml_encoder_h__ */
index dbaff1a..744c8f2 100644 (file)
@@ -22,6 +22,7 @@
 
 #include "internal.h"
 #include "binding/MessageDecoder.h"
+#include "util/SAMLConstants.h"
 
 using namespace opensaml;
 using namespace xmltooling;
@@ -41,8 +42,8 @@ namespace opensaml {
 void SAML_API opensaml::registerMessageDecoders()
 {
     SAMLConfig& conf=SAMLConfig::getConfig();
-    conf.MessageDecoderManager.registerFactory(SAML1_ARTIFACT_DECODER, saml1p::SAML1ArtifactDecoderFactory);
-    conf.MessageDecoderManager.registerFactory(SAML1_POST_DECODER, saml1p::SAML1POSTDecoderFactory);
-    conf.MessageDecoderManager.registerFactory(SAML2_ARTIFACT_DECODER, saml2p::SAML2ArtifactDecoderFactory);
-    conf.MessageDecoderManager.registerFactory(SAML2_POST_DECODER, saml2p::SAML2POSTDecoderFactory);
+    conf.MessageDecoderManager.registerFactory(SAMLConstants::SAML1_PROFILE_BROWSER_ARTIFACT, saml1p::SAML1ArtifactDecoderFactory);
+    conf.MessageDecoderManager.registerFactory(SAMLConstants::SAML1_PROFILE_BROWSER_POST, saml1p::SAML1POSTDecoderFactory);
+    conf.MessageDecoderManager.registerFactory(SAMLConstants::SAML20_BINDING_HTTP_ARTIFACT, saml2p::SAML2ArtifactDecoderFactory);
+    conf.MessageDecoderManager.registerFactory(SAMLConstants::SAML20_BINDING_HTTP_POST, saml2p::SAML2POSTDecoderFactory);
 }
index 825f5f7..53880b5 100644 (file)
@@ -22,6 +22,7 @@
 
 #include "internal.h"
 #include "binding/MessageEncoder.h"
+#include "util/SAMLConstants.h"
 
 #include <xmltooling/signature/KeyInfo.h>
 #include <xmltooling/signature/Signature.h>
@@ -46,10 +47,10 @@ namespace opensaml {
 void SAML_API opensaml::registerMessageEncoders()
 {
     SAMLConfig& conf=SAMLConfig::getConfig();
-    conf.MessageEncoderManager.registerFactory(SAML1_ARTIFACT_ENCODER, saml1p::SAML1ArtifactEncoderFactory);
-    conf.MessageEncoderManager.registerFactory(SAML1_POST_ENCODER, saml1p::SAML1POSTEncoderFactory);
-    conf.MessageEncoderManager.registerFactory(SAML2_ARTIFACT_ENCODER, saml2p::SAML2ArtifactEncoderFactory);
-    conf.MessageEncoderManager.registerFactory(SAML2_POST_ENCODER, saml2p::SAML2POSTEncoderFactory);
+    conf.MessageEncoderManager.registerFactory(SAMLConstants::SAML1_PROFILE_BROWSER_ARTIFACT, saml1p::SAML1ArtifactEncoderFactory);
+    conf.MessageEncoderManager.registerFactory(SAMLConstants::SAML1_PROFILE_BROWSER_POST, saml1p::SAML1POSTEncoderFactory);
+    conf.MessageEncoderManager.registerFactory(SAMLConstants::SAML20_BINDING_HTTP_ARTIFACT, saml2p::SAML2ArtifactEncoderFactory);
+    conf.MessageEncoderManager.registerFactory(SAMLConstants::SAML20_BINDING_HTTP_POST, saml2p::SAML2POSTEncoderFactory);
 }
 
 namespace {
index 7fcdc2c..08dfdd9 100644 (file)
@@ -176,3 +176,13 @@ const XMLCh SAMLConstants::SAML20P_THIRDPARTY_EXT_NS[] = // urn:oasis:names:tc:S
 };
 
 const XMLCh SAMLConstants::SAML20P_THIRDPARTY_EXT_PREFIX[] = UNICODE_LITERAL_6(t,h,r,p,t,y);
+
+const char SAMLConstants::SAML1_PROFILE_BROWSER_ARTIFACT[] = "urn:oasis:names:tc:SAML:1.0:profiles:artifact-01";
+
+const char SAMLConstants::SAML1_PROFILE_BROWSER_POST[] = "urn:oasis:names:tc:SAML:1.0:profiles:browser-post";
+
+const char SAMLConstants::SAML20_BINDING_HTTP_ARTIFACT[] = "urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Artifact";
+
+const char SAMLConstants::SAML20_BINDING_HTTP_POST[] = "urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST";
+
+const char SAMLConstants::SAML20_BINDING_HTTP_REDIRECT[] = "urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Redirect";
index deb2d08..81b558a 100644 (file)
@@ -124,6 +124,21 @@ namespace opensaml {
         
         /** SAML Third-Party Request Protocol Extension QName prefix ("query") */
         static const XMLCh SAML20P_THIRDPARTY_EXT_PREFIX[];
+
+        /** SAML 1.x Browser Artifact profile ("urn:oasis:names:tc:SAML:1.0:profiles:artifact-01")*/
+        static const char SAML1_PROFILE_BROWSER_ARTIFACT[];
+    
+        /** SAML 1.x Browser POST profile ("urn:oasis:names:tc:SAML:1.0:profiles:browser-post") */
+        static const char SAML1_PROFILE_BROWSER_POST[];
+        
+        /** SAML 2.0 HTTP-Artifact binding ("urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Artifact") */
+        static const char SAML20_BINDING_HTTP_ARTIFACT[];
+    
+        /** SAML 2.0 HTTP-POST binding ("urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST") */
+        static const char SAML20_BINDING_HTTP_POST[];
+
+        /** SAML 2.0 HTTP-Redirect binding ("urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Redirect") */
+        static const char SAML20_BINDING_HTTP_REDIRECT[];
     };
 
 };
index 8413815..a133cf1 100644 (file)
@@ -51,7 +51,9 @@ public:
             janitor.release();
 
             // Encode message.
-            auto_ptr<MessageEncoder> encoder(SAMLConfig::getConfig().MessageEncoderManager.newPlugin(SAML1_ARTIFACT_ENCODER, NULL));
+            auto_ptr<MessageEncoder> encoder(
+                SAMLConfig::getConfig().MessageEncoderManager.newPlugin(SAMLConstants::SAML1_PROFILE_BROWSER_ARTIFACT, NULL)
+                );
             encoder->setArtifactGenerator(this);
             encoder->encode(m_fields,toSend.get(),"https://sp.example.org/","state",m_creds);
             toSend.release();
@@ -61,7 +63,9 @@ public:
             const RoleDescriptor* issuer=NULL;
             bool trusted=false;
             QName idprole(SAMLConstants::SAML20MD_NS, IDPSSODescriptor::LOCAL_NAME);
-            auto_ptr<MessageDecoder> decoder(SAMLConfig::getConfig().MessageDecoderManager.newPlugin(SAML1_ARTIFACT_DECODER, NULL));
+            auto_ptr<MessageDecoder> decoder(
+                SAMLConfig::getConfig().MessageDecoderManager.newPlugin(SAMLConstants::SAML1_PROFILE_BROWSER_ARTIFACT, NULL)
+                );
             decoder->setArtifactResolver(this);
             Locker locker(m_metadata);
             auto_ptr<Response> response(
index 6872867..4b26224 100644 (file)
@@ -49,7 +49,9 @@ public:
             toSend->setIssueInstant(time(NULL));
     
             // Encode message.
-            auto_ptr<MessageEncoder> encoder(SAMLConfig::getConfig().MessageEncoderManager.newPlugin(SAML1_POST_ENCODER, NULL));
+            auto_ptr<MessageEncoder> encoder(
+                SAMLConfig::getConfig().MessageEncoderManager.newPlugin(SAMLConstants::SAML1_PROFILE_BROWSER_POST, NULL)
+                );
             encoder->encode(m_fields,toSend.get(),"https://sp.example.org/","state",m_creds);
             toSend.release();
             
@@ -58,7 +60,9 @@ public:
             const RoleDescriptor* issuer=NULL;
             bool trusted=false;
             QName idprole(SAMLConstants::SAML20MD_NS, IDPSSODescriptor::LOCAL_NAME);
-            auto_ptr<MessageDecoder> decoder(SAMLConfig::getConfig().MessageDecoderManager.newPlugin(SAML1_POST_DECODER, NULL));
+            auto_ptr<MessageDecoder> decoder(
+                SAMLConfig::getConfig().MessageDecoderManager.newPlugin(SAMLConstants::SAML1_PROFILE_BROWSER_POST, NULL)
+                );
             Locker locker(m_metadata);
             auto_ptr<Response> response(
                 dynamic_cast<Response*>(
@@ -97,7 +101,9 @@ public:
             toSend->setResponseID(NULL);
     
             // Encode message.
-            auto_ptr<MessageEncoder> encoder(SAMLConfig::getConfig().MessageEncoderManager.newPlugin(SAML1_POST_ENCODER, NULL));
+            auto_ptr<MessageEncoder> encoder(
+                SAMLConfig::getConfig().MessageEncoderManager.newPlugin(SAMLConstants::SAML1_PROFILE_BROWSER_POST, NULL)
+                );
             encoder->encode(m_fields,toSend.get(),"https://sp.example.org/","state");
             toSend.release();
             
@@ -106,7 +112,9 @@ public:
             const RoleDescriptor* issuer=NULL;
             bool trusted=false;
             QName idprole(SAMLConstants::SAML20MD_NS, IDPSSODescriptor::LOCAL_NAME);
-            auto_ptr<MessageDecoder> decoder(SAMLConfig::getConfig().MessageDecoderManager.newPlugin(SAML1_POST_DECODER, NULL));
+            auto_ptr<MessageDecoder> decoder(
+                SAMLConfig::getConfig().MessageDecoderManager.newPlugin(SAMLConstants::SAML1_PROFILE_BROWSER_POST, NULL)
+                );
             Locker locker(m_metadata);
             auto_ptr<Response> response(
                 dynamic_cast<Response*>(
index ea5717f..c785bd3 100644 (file)
@@ -53,7 +53,9 @@ public:
             toSend->setIssueInstant(time(NULL));
 
             // Encode message.
-            auto_ptr<MessageEncoder> encoder(SAMLConfig::getConfig().MessageEncoderManager.newPlugin(SAML2_ARTIFACT_ENCODER, NULL));
+            auto_ptr<MessageEncoder> encoder(
+                SAMLConfig::getConfig().MessageEncoderManager.newPlugin(SAMLConstants::SAML20_BINDING_HTTP_ARTIFACT, NULL)
+                );
             encoder->setArtifactGenerator(this);
             encoder->encode(m_fields,toSend.get(),"https://sp.example.org/","state",m_creds);
             toSend.release();
@@ -63,7 +65,9 @@ public:
             const RoleDescriptor* issuer=NULL;
             bool trusted=false;
             QName idprole(SAMLConstants::SAML20MD_NS, IDPSSODescriptor::LOCAL_NAME);
-            auto_ptr<MessageDecoder> decoder(SAMLConfig::getConfig().MessageDecoderManager.newPlugin(SAML2_ARTIFACT_DECODER, NULL));
+            auto_ptr<MessageDecoder> decoder(
+                SAMLConfig::getConfig().MessageDecoderManager.newPlugin(SAMLConstants::SAML20_BINDING_HTTP_ARTIFACT, NULL)
+                );
             decoder->setArtifactResolver(this);
             Locker locker(m_metadata);
             auto_ptr<Response> response(
index c4addc7..77cd153 100644 (file)
@@ -49,7 +49,9 @@ public:
             toSend->setIssueInstant(time(NULL));
     
             // Encode message.
-            auto_ptr<MessageEncoder> encoder(SAMLConfig::getConfig().MessageEncoderManager.newPlugin(SAML2_POST_ENCODER, NULL));
+            auto_ptr<MessageEncoder> encoder(
+                SAMLConfig::getConfig().MessageEncoderManager.newPlugin(SAMLConstants::SAML20_BINDING_HTTP_POST, NULL)
+                );
             encoder->encode(m_fields,toSend.get(),"https://sp.example.org/","state",m_creds);
             toSend.release();
             
@@ -58,7 +60,9 @@ public:
             const RoleDescriptor* issuer=NULL;
             bool trusted=false;
             QName idprole(SAMLConstants::SAML20MD_NS, IDPSSODescriptor::LOCAL_NAME);
-            auto_ptr<MessageDecoder> decoder(SAMLConfig::getConfig().MessageDecoderManager.newPlugin(SAML2_POST_DECODER, NULL));
+            auto_ptr<MessageDecoder> decoder(
+                SAMLConfig::getConfig().MessageDecoderManager.newPlugin(SAMLConstants::SAML20_BINDING_HTTP_POST, NULL)
+                );
             Locker locker(m_metadata);
             auto_ptr<Response> response(
                 dynamic_cast<Response*>(
@@ -97,7 +101,9 @@ public:
             toSend->setID(NULL);
     
             // Encode message.
-            auto_ptr<MessageEncoder> encoder(SAMLConfig::getConfig().MessageEncoderManager.newPlugin(SAML2_POST_ENCODER, NULL));
+            auto_ptr<MessageEncoder> encoder(
+                SAMLConfig::getConfig().MessageEncoderManager.newPlugin(SAMLConstants::SAML20_BINDING_HTTP_POST, NULL)
+                );
             encoder->encode(m_fields,toSend.get(),"https://sp.example.org/","state");
             toSend.release();
             
@@ -106,7 +112,9 @@ public:
             const RoleDescriptor* issuer=NULL;
             bool trusted=false;
             QName idprole(SAMLConstants::SAML20MD_NS, IDPSSODescriptor::LOCAL_NAME);
-            auto_ptr<MessageDecoder> decoder(SAMLConfig::getConfig().MessageDecoderManager.newPlugin(SAML2_POST_DECODER, NULL));
+            auto_ptr<MessageDecoder> decoder(
+                SAMLConfig::getConfig().MessageDecoderManager.newPlugin(SAMLConstants::SAML20_BINDING_HTTP_POST, NULL)
+                );
             Locker locker(m_metadata);
             auto_ptr<Response> response(
                 dynamic_cast<Response*>(