From b66d32ed939fcf6db7bc52c8626b6ac06a2e97f9 Mon Sep 17 00:00:00 2001 From: Scott Cantor Date: Fri, 13 Oct 2006 19:53:38 +0000 Subject: [PATCH] Moved/renamed binding constants. --- saml/binding/MessageDecoder.h | 15 --------------- saml/binding/MessageEncoder.h | 15 --------------- saml/binding/impl/MessageDecoder.cpp | 9 +++++---- saml/binding/impl/MessageEncoder.cpp | 9 +++++---- saml/util/SAMLConstants.cpp | 10 ++++++++++ saml/util/SAMLConstants.h | 15 +++++++++++++++ samltest/saml1/binding/SAML1ArtifactTest.h | 8 ++++++-- samltest/saml1/binding/SAML1POSTTest.h | 16 ++++++++++++---- samltest/saml2/binding/SAML2ArtifactTest.h | 8 ++++++-- samltest/saml2/binding/SAML2POSTTest.h | 16 ++++++++++++---- 10 files changed, 71 insertions(+), 50 deletions(-) diff --git a/saml/binding/MessageDecoder.h b/saml/binding/MessageDecoder.h index 364d6a5..535dfc4 100644 --- a/saml/binding/MessageDecoder.h +++ b/saml/binding/MessageDecoder.h @@ -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__ */ diff --git a/saml/binding/MessageEncoder.h b/saml/binding/MessageEncoder.h index 668049a..4d23033 100644 --- a/saml/binding/MessageEncoder.h +++ b/saml/binding/MessageEncoder.h @@ -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__ */ diff --git a/saml/binding/impl/MessageDecoder.cpp b/saml/binding/impl/MessageDecoder.cpp index dbaff1a..744c8f2 100644 --- a/saml/binding/impl/MessageDecoder.cpp +++ b/saml/binding/impl/MessageDecoder.cpp @@ -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); } diff --git a/saml/binding/impl/MessageEncoder.cpp b/saml/binding/impl/MessageEncoder.cpp index 825f5f7..53880b5 100644 --- a/saml/binding/impl/MessageEncoder.cpp +++ b/saml/binding/impl/MessageEncoder.cpp @@ -22,6 +22,7 @@ #include "internal.h" #include "binding/MessageEncoder.h" +#include "util/SAMLConstants.h" #include #include @@ -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 { diff --git a/saml/util/SAMLConstants.cpp b/saml/util/SAMLConstants.cpp index 7fcdc2c..08dfdd9 100644 --- a/saml/util/SAMLConstants.cpp +++ b/saml/util/SAMLConstants.cpp @@ -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"; diff --git a/saml/util/SAMLConstants.h b/saml/util/SAMLConstants.h index deb2d08..81b558a 100644 --- a/saml/util/SAMLConstants.h +++ b/saml/util/SAMLConstants.h @@ -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[]; }; }; diff --git a/samltest/saml1/binding/SAML1ArtifactTest.h b/samltest/saml1/binding/SAML1ArtifactTest.h index 8413815..a133cf1 100644 --- a/samltest/saml1/binding/SAML1ArtifactTest.h +++ b/samltest/saml1/binding/SAML1ArtifactTest.h @@ -51,7 +51,9 @@ public: janitor.release(); // Encode message. - auto_ptr encoder(SAMLConfig::getConfig().MessageEncoderManager.newPlugin(SAML1_ARTIFACT_ENCODER, NULL)); + auto_ptr 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 decoder(SAMLConfig::getConfig().MessageDecoderManager.newPlugin(SAML1_ARTIFACT_DECODER, NULL)); + auto_ptr decoder( + SAMLConfig::getConfig().MessageDecoderManager.newPlugin(SAMLConstants::SAML1_PROFILE_BROWSER_ARTIFACT, NULL) + ); decoder->setArtifactResolver(this); Locker locker(m_metadata); auto_ptr response( diff --git a/samltest/saml1/binding/SAML1POSTTest.h b/samltest/saml1/binding/SAML1POSTTest.h index 6872867..4b26224 100644 --- a/samltest/saml1/binding/SAML1POSTTest.h +++ b/samltest/saml1/binding/SAML1POSTTest.h @@ -49,7 +49,9 @@ public: toSend->setIssueInstant(time(NULL)); // Encode message. - auto_ptr encoder(SAMLConfig::getConfig().MessageEncoderManager.newPlugin(SAML1_POST_ENCODER, NULL)); + auto_ptr 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 decoder(SAMLConfig::getConfig().MessageDecoderManager.newPlugin(SAML1_POST_DECODER, NULL)); + auto_ptr decoder( + SAMLConfig::getConfig().MessageDecoderManager.newPlugin(SAMLConstants::SAML1_PROFILE_BROWSER_POST, NULL) + ); Locker locker(m_metadata); auto_ptr response( dynamic_cast( @@ -97,7 +101,9 @@ public: toSend->setResponseID(NULL); // Encode message. - auto_ptr encoder(SAMLConfig::getConfig().MessageEncoderManager.newPlugin(SAML1_POST_ENCODER, NULL)); + auto_ptr 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 decoder(SAMLConfig::getConfig().MessageDecoderManager.newPlugin(SAML1_POST_DECODER, NULL)); + auto_ptr decoder( + SAMLConfig::getConfig().MessageDecoderManager.newPlugin(SAMLConstants::SAML1_PROFILE_BROWSER_POST, NULL) + ); Locker locker(m_metadata); auto_ptr response( dynamic_cast( diff --git a/samltest/saml2/binding/SAML2ArtifactTest.h b/samltest/saml2/binding/SAML2ArtifactTest.h index ea5717f..c785bd3 100644 --- a/samltest/saml2/binding/SAML2ArtifactTest.h +++ b/samltest/saml2/binding/SAML2ArtifactTest.h @@ -53,7 +53,9 @@ public: toSend->setIssueInstant(time(NULL)); // Encode message. - auto_ptr encoder(SAMLConfig::getConfig().MessageEncoderManager.newPlugin(SAML2_ARTIFACT_ENCODER, NULL)); + auto_ptr 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 decoder(SAMLConfig::getConfig().MessageDecoderManager.newPlugin(SAML2_ARTIFACT_DECODER, NULL)); + auto_ptr decoder( + SAMLConfig::getConfig().MessageDecoderManager.newPlugin(SAMLConstants::SAML20_BINDING_HTTP_ARTIFACT, NULL) + ); decoder->setArtifactResolver(this); Locker locker(m_metadata); auto_ptr response( diff --git a/samltest/saml2/binding/SAML2POSTTest.h b/samltest/saml2/binding/SAML2POSTTest.h index c4addc7..77cd153 100644 --- a/samltest/saml2/binding/SAML2POSTTest.h +++ b/samltest/saml2/binding/SAML2POSTTest.h @@ -49,7 +49,9 @@ public: toSend->setIssueInstant(time(NULL)); // Encode message. - auto_ptr encoder(SAMLConfig::getConfig().MessageEncoderManager.newPlugin(SAML2_POST_ENCODER, NULL)); + auto_ptr 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 decoder(SAMLConfig::getConfig().MessageDecoderManager.newPlugin(SAML2_POST_DECODER, NULL)); + auto_ptr decoder( + SAMLConfig::getConfig().MessageDecoderManager.newPlugin(SAMLConstants::SAML20_BINDING_HTTP_POST, NULL) + ); Locker locker(m_metadata); auto_ptr response( dynamic_cast( @@ -97,7 +101,9 @@ public: toSend->setID(NULL); // Encode message. - auto_ptr encoder(SAMLConfig::getConfig().MessageEncoderManager.newPlugin(SAML2_POST_ENCODER, NULL)); + auto_ptr 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 decoder(SAMLConfig::getConfig().MessageDecoderManager.newPlugin(SAML2_POST_DECODER, NULL)); + auto_ptr decoder( + SAMLConfig::getConfig().MessageDecoderManager.newPlugin(SAMLConstants::SAML20_BINDING_HTTP_POST, NULL) + ); Locker locker(m_metadata); auto_ptr response( dynamic_cast( -- 2.1.4