From 40fdf576ed07e3cf8f88d9bf0441e55ea4fc3d05 Mon Sep 17 00:00:00 2001 From: Scott Cantor Date: Wed, 11 Aug 2010 18:36:47 +0000 Subject: [PATCH] Add short name to encoders/decoders for endpoint generation. --- saml/binding/MessageDecoder.h | 7 +++++++ saml/binding/MessageEncoder.h | 7 +++++++ saml/binding/impl/MessageDecoder.cpp | 8 +++++++- saml/binding/impl/MessageEncoder.cpp | 5 +++++ saml/saml1/binding/impl/SAML1ArtifactDecoder.cpp | 4 ++++ saml/saml1/binding/impl/SAML1ArtifactEncoder.cpp | 4 ++++ saml/saml1/binding/impl/SAML1POSTDecoder.cpp | 6 +++++- saml/saml1/binding/impl/SAML1POSTEncoder.cpp | 4 ++++ saml/saml1/binding/impl/SAML1SOAPDecoder.cpp | 4 ++++ saml/saml1/binding/impl/SAML1SOAPEncoder.cpp | 4 ++++ saml/saml2/binding/impl/SAML2ArtifactDecoder.cpp | 4 ++++ saml/saml2/binding/impl/SAML2ArtifactEncoder.cpp | 4 ++++ saml/saml2/binding/impl/SAML2ECPDecoder.cpp | 4 ++++ saml/saml2/binding/impl/SAML2ECPEncoder.cpp | 4 ++++ saml/saml2/binding/impl/SAML2POSTDecoder.cpp | 20 +++++++++++++++++--- saml/saml2/binding/impl/SAML2POSTEncoder.cpp | 4 ++++ saml/saml2/binding/impl/SAML2RedirectDecoder.cpp | 4 ++++ saml/saml2/binding/impl/SAML2RedirectEncoder.cpp | 4 ++++ saml/saml2/binding/impl/SAML2SOAPDecoder.cpp | 4 ++++ saml/saml2/binding/impl/SAML2SOAPEncoder.cpp | 4 ++++ 20 files changed, 104 insertions(+), 5 deletions(-) diff --git a/saml/binding/MessageDecoder.h b/saml/binding/MessageDecoder.h index bbe176e..ad7ad47 100644 --- a/saml/binding/MessageDecoder.h +++ b/saml/binding/MessageDecoder.h @@ -68,6 +68,13 @@ namespace opensaml { virtual const XMLCh* getProtocolFamily() const; /** + * Returns a shorthand name for the binding/encoding supported by the decoder. + * + * @return a short name for the binding/encoding, or nullptr + */ + virtual const char* getShortName() const; + + /** * Indicates whether a web browser or similar user agent delivered the message. * * @return true iff the message was delivered by a user agent diff --git a/saml/binding/MessageEncoder.h b/saml/binding/MessageEncoder.h index 095a523..96c30b3 100644 --- a/saml/binding/MessageEncoder.h +++ b/saml/binding/MessageEncoder.h @@ -72,6 +72,13 @@ namespace opensaml { virtual const XMLCh* getProtocolFamily() const; /** + * Returns a shorthand name for the binding/encoding supported by the encoder. + * + * @return a short name for the binding/encoding, or nullptr + */ + virtual const char* getShortName() const; + + /** * Interface to caller-supplied artifact generation mechanism. * * Generating an artifact for storage and retrieval requires knowledge of diff --git a/saml/binding/impl/MessageDecoder.cpp b/saml/binding/impl/MessageDecoder.cpp index 4ff6c79..8c33780 100644 --- a/saml/binding/impl/MessageDecoder.cpp +++ b/saml/binding/impl/MessageDecoder.cpp @@ -43,6 +43,7 @@ namespace opensaml { namespace saml2p { SAML_DLLLOCAL PluginManager< MessageDecoder,string,pair >::Factory SAML2ArtifactDecoderFactory; SAML_DLLLOCAL PluginManager< MessageDecoder,string,pair >::Factory SAML2POSTDecoderFactory; + SAML_DLLLOCAL PluginManager< MessageDecoder,string,pair >::Factory SAML2POSTSimpleSignDecoderFactory; SAML_DLLLOCAL PluginManager< MessageDecoder,string,pair >::Factory SAML2RedirectDecoderFactory; SAML_DLLLOCAL PluginManager< MessageDecoder,string,pair >::Factory SAML2SOAPDecoderFactory; SAML_DLLLOCAL PluginManager< MessageDecoder,string,pair >::Factory SAML2ECPDecoderFactory; @@ -57,7 +58,7 @@ void SAML_API opensaml::registerMessageDecoders() conf.MessageDecoderManager.registerFactory(samlconstants::SAML1_BINDING_SOAP, saml1p::SAML1SOAPDecoderFactory); conf.MessageDecoderManager.registerFactory(samlconstants::SAML20_BINDING_HTTP_ARTIFACT, saml2p::SAML2ArtifactDecoderFactory); conf.MessageDecoderManager.registerFactory(samlconstants::SAML20_BINDING_HTTP_POST, saml2p::SAML2POSTDecoderFactory); - conf.MessageDecoderManager.registerFactory(samlconstants::SAML20_BINDING_HTTP_POST_SIMPLESIGN, saml2p::SAML2POSTDecoderFactory); + conf.MessageDecoderManager.registerFactory(samlconstants::SAML20_BINDING_HTTP_POST_SIMPLESIGN, saml2p::SAML2POSTSimpleSignDecoderFactory); conf.MessageDecoderManager.registerFactory(samlconstants::SAML20_BINDING_HTTP_REDIRECT, saml2p::SAML2RedirectDecoderFactory); conf.MessageDecoderManager.registerFactory(samlconstants::SAML20_BINDING_SOAP, saml2p::SAML2SOAPDecoderFactory); conf.MessageDecoderManager.registerFactory(samlconstants::SAML20_BINDING_PAOS, saml2p::SAML2ECPDecoderFactory); @@ -79,6 +80,11 @@ const XMLCh* MessageDecoder::getProtocolFamily() const return nullptr; } +const char* MessageDecoder::getShortName() const +{ + return nullptr; +} + bool MessageDecoder::isUserAgentPresent() const { return true; diff --git a/saml/binding/impl/MessageEncoder.cpp b/saml/binding/impl/MessageEncoder.cpp index 035ad55..2665f04 100644 --- a/saml/binding/impl/MessageEncoder.cpp +++ b/saml/binding/impl/MessageEncoder.cpp @@ -76,6 +76,11 @@ const XMLCh* MessageEncoder::getProtocolFamily() const return nullptr; } +const char* MessageEncoder::getShortName() const +{ + return nullptr; +} + bool MessageEncoder::isCompact() const { return false; diff --git a/saml/saml1/binding/impl/SAML1ArtifactDecoder.cpp b/saml/saml1/binding/impl/SAML1ArtifactDecoder.cpp index ad6e2d9..12552ad 100644 --- a/saml/saml1/binding/impl/SAML1ArtifactDecoder.cpp +++ b/saml/saml1/binding/impl/SAML1ArtifactDecoder.cpp @@ -50,6 +50,10 @@ namespace opensaml { SAML1ArtifactDecoder() {} virtual ~SAML1ArtifactDecoder() {} + const char* getShortName() const { + return "Artifact"; + } + xmltooling::XMLObject* decode( std::string& relayState, const GenericRequest& genericRequest, diff --git a/saml/saml1/binding/impl/SAML1ArtifactEncoder.cpp b/saml/saml1/binding/impl/SAML1ArtifactEncoder.cpp index 99c1432..4e38da3 100644 --- a/saml/saml1/binding/impl/SAML1ArtifactEncoder.cpp +++ b/saml/saml1/binding/impl/SAML1ArtifactEncoder.cpp @@ -56,6 +56,10 @@ namespace opensaml { return samlconstants::SAML11_PROTOCOL_ENUM; } + const char* getShortName() const { + return "Artifact"; + } + long encode( GenericResponse& genericResponse, XMLObject* xmlObject, diff --git a/saml/saml1/binding/impl/SAML1POSTDecoder.cpp b/saml/saml1/binding/impl/SAML1POSTDecoder.cpp index 4c59745..2ae3d8d 100644 --- a/saml/saml1/binding/impl/SAML1POSTDecoder.cpp +++ b/saml/saml1/binding/impl/SAML1POSTDecoder.cpp @@ -54,7 +54,11 @@ namespace opensaml { public: SAML1POSTDecoder() {} virtual ~SAML1POSTDecoder() {} - + + const char* getShortName() const { + return "POST"; + } + xmltooling::XMLObject* decode( std::string& relayState, const GenericRequest& genericRequest, diff --git a/saml/saml1/binding/impl/SAML1POSTEncoder.cpp b/saml/saml1/binding/impl/SAML1POSTEncoder.cpp index 73dc625..64a2511 100644 --- a/saml/saml1/binding/impl/SAML1POSTEncoder.cpp +++ b/saml/saml1/binding/impl/SAML1POSTEncoder.cpp @@ -58,6 +58,10 @@ namespace opensaml { return samlconstants::SAML11_PROTOCOL_ENUM; } + const char* getShortName() const { + return "POST"; + } + long encode( GenericResponse& genericResponse, XMLObject* xmlObject, diff --git a/saml/saml1/binding/impl/SAML1SOAPDecoder.cpp b/saml/saml1/binding/impl/SAML1SOAPDecoder.cpp index 6a9e29c..12be2b4 100644 --- a/saml/saml1/binding/impl/SAML1SOAPDecoder.cpp +++ b/saml/saml1/binding/impl/SAML1SOAPDecoder.cpp @@ -53,6 +53,10 @@ namespace opensaml { return false; } + const char* getShortName() const { + return "SOAP"; + } + xmltooling::XMLObject* decode( std::string& relayState, const GenericRequest& genericRequest, diff --git a/saml/saml1/binding/impl/SAML1SOAPEncoder.cpp b/saml/saml1/binding/impl/SAML1SOAPEncoder.cpp index 4aef15f..43c96c4 100644 --- a/saml/saml1/binding/impl/SAML1SOAPEncoder.cpp +++ b/saml/saml1/binding/impl/SAML1SOAPEncoder.cpp @@ -54,6 +54,10 @@ namespace opensaml { return false; } + const char* getShortName() const { + return "POST"; + } + const XMLCh* getProtocolFamily() const { return samlconstants::SAML11_PROTOCOL_ENUM; } diff --git a/saml/saml2/binding/impl/SAML2ArtifactDecoder.cpp b/saml/saml2/binding/impl/SAML2ArtifactDecoder.cpp index b58d356..32ca0f4 100644 --- a/saml/saml2/binding/impl/SAML2ArtifactDecoder.cpp +++ b/saml/saml2/binding/impl/SAML2ArtifactDecoder.cpp @@ -51,6 +51,10 @@ namespace opensaml { SAML2ArtifactDecoder() {} virtual ~SAML2ArtifactDecoder() {} + const char* getShortName() const { + return "Artifact"; + } + xmltooling::XMLObject* decode( std::string& relayState, const GenericRequest& genericRequest, diff --git a/saml/saml2/binding/impl/SAML2ArtifactEncoder.cpp b/saml/saml2/binding/impl/SAML2ArtifactEncoder.cpp index 138fbd2..b16e9c1 100644 --- a/saml/saml2/binding/impl/SAML2ArtifactEncoder.cpp +++ b/saml/saml2/binding/impl/SAML2ArtifactEncoder.cpp @@ -60,6 +60,10 @@ namespace opensaml { return samlconstants::SAML20P_NS; } + const char* getShortName() const { + return "Artifact"; + } + long encode( GenericResponse& genericResponse, XMLObject* xmlObject, diff --git a/saml/saml2/binding/impl/SAML2ECPDecoder.cpp b/saml/saml2/binding/impl/SAML2ECPDecoder.cpp index 53f2210..620c802 100644 --- a/saml/saml2/binding/impl/SAML2ECPDecoder.cpp +++ b/saml/saml2/binding/impl/SAML2ECPDecoder.cpp @@ -50,6 +50,10 @@ namespace opensaml { SAML2ECPDecoder() {} virtual ~SAML2ECPDecoder() {} + const char* getShortName() const { + return "ECP"; + } + xmltooling::XMLObject* decode( std::string& relayState, const GenericRequest& genericRequest, diff --git a/saml/saml2/binding/impl/SAML2ECPEncoder.cpp b/saml/saml2/binding/impl/SAML2ECPEncoder.cpp index 36c0fce..103080c 100644 --- a/saml/saml2/binding/impl/SAML2ECPEncoder.cpp +++ b/saml/saml2/binding/impl/SAML2ECPEncoder.cpp @@ -68,6 +68,10 @@ namespace opensaml { return samlconstants::SAML20P_NS; } + const char* getShortName() const { + return "ECP"; + } + long encode( GenericResponse& genericResponse, XMLObject* xmlObject, diff --git a/saml/saml2/binding/impl/SAML2POSTDecoder.cpp b/saml/saml2/binding/impl/SAML2POSTDecoder.cpp index 40565fa..64404ce 100644 --- a/saml/saml2/binding/impl/SAML2POSTDecoder.cpp +++ b/saml/saml2/binding/impl/SAML2POSTDecoder.cpp @@ -51,19 +51,33 @@ namespace opensaml { class SAML_DLLLOCAL SAML2POSTDecoder : public SAML2MessageDecoder { public: - SAML2POSTDecoder() {} + SAML2POSTDecoder(const DOMElement* e, const XMLCh* ns, bool simple=false) { + } + virtual ~SAML2POSTDecoder() {} - + + const char* getShortName() const { + return m_simple ? "POST-SimpleSign" : "POST"; + } + xmltooling::XMLObject* decode( std::string& relayState, const GenericRequest& genericRequest, SecurityPolicy& policy ) const; + + private: + bool m_simple; }; MessageDecoder* SAML_DLLLOCAL SAML2POSTDecoderFactory(const pair& p) { - return new SAML2POSTDecoder(); + return new SAML2POSTDecoder(p.first, p.second, false); + } + + MessageDecoder* SAML_DLLLOCAL SAML2POSTSimpleSignDecoderFactory(const pair& p) + { + return new SAML2POSTDecoder(p.first, p.second, true); } }; }; diff --git a/saml/saml2/binding/impl/SAML2POSTEncoder.cpp b/saml/saml2/binding/impl/SAML2POSTEncoder.cpp index 53f08cf..8489888 100644 --- a/saml/saml2/binding/impl/SAML2POSTEncoder.cpp +++ b/saml/saml2/binding/impl/SAML2POSTEncoder.cpp @@ -60,6 +60,10 @@ namespace opensaml { return samlconstants::SAML20P_NS; } + const char* getShortName() const { + return m_simple ? "POST-SimpleSign" : "POST"; + } + long encode( GenericResponse& genericResponse, XMLObject* xmlObject, diff --git a/saml/saml2/binding/impl/SAML2RedirectDecoder.cpp b/saml/saml2/binding/impl/SAML2RedirectDecoder.cpp index f81584f..d1ad87e 100644 --- a/saml/saml2/binding/impl/SAML2RedirectDecoder.cpp +++ b/saml/saml2/binding/impl/SAML2RedirectDecoder.cpp @@ -54,6 +54,10 @@ namespace opensaml { SAML2RedirectDecoder() {} virtual ~SAML2RedirectDecoder() {} + const char* getShortName() const { + return "Redirect"; + } + xmltooling::XMLObject* decode( std::string& relayState, const GenericRequest& genericRequest, diff --git a/saml/saml2/binding/impl/SAML2RedirectEncoder.cpp b/saml/saml2/binding/impl/SAML2RedirectEncoder.cpp index 616d98f..58c7a66 100644 --- a/saml/saml2/binding/impl/SAML2RedirectEncoder.cpp +++ b/saml/saml2/binding/impl/SAML2RedirectEncoder.cpp @@ -62,6 +62,10 @@ namespace opensaml { return samlconstants::SAML20P_NS; } + const char* getShortName() const { + return "Redirect"; + } + long encode( GenericResponse& genericResponse, XMLObject* xmlObject, diff --git a/saml/saml2/binding/impl/SAML2SOAPDecoder.cpp b/saml/saml2/binding/impl/SAML2SOAPDecoder.cpp index 69848be..e4e81e6 100644 --- a/saml/saml2/binding/impl/SAML2SOAPDecoder.cpp +++ b/saml/saml2/binding/impl/SAML2SOAPDecoder.cpp @@ -53,6 +53,10 @@ namespace opensaml { return false; } + const char* getShortName() const { + return "SOAP"; + } + xmltooling::XMLObject* decode( std::string& relayState, const GenericRequest& genericRequest, diff --git a/saml/saml2/binding/impl/SAML2SOAPEncoder.cpp b/saml/saml2/binding/impl/SAML2SOAPEncoder.cpp index f9a2e1c..a7b5b9c 100644 --- a/saml/saml2/binding/impl/SAML2SOAPEncoder.cpp +++ b/saml/saml2/binding/impl/SAML2SOAPEncoder.cpp @@ -58,6 +58,10 @@ namespace opensaml { return samlconstants::SAML20P_NS; } + const char* getShortName() const { + return "SOAP"; + } + long encode( GenericResponse& genericResponse, XMLObject* xmlObject, -- 2.1.4