From 5e62d2c1fb43763b3d627e641a310a79992b01c0 Mon Sep 17 00:00:00 2001 From: Scott Cantor Date: Tue, 10 Aug 2010 03:02:04 +0000 Subject: [PATCH] Add property for protocol family to encoders/decoders. --- saml/binding/MessageDecoder.h | 9 ++++++++- saml/binding/MessageEncoder.h | 7 +++++++ saml/binding/impl/MessageDecoder.cpp | 5 +++++ saml/binding/impl/MessageEncoder.cpp | 7 ++++++- saml/saml1/binding/SAML1MessageDecoder.h | 3 ++- saml/saml1/binding/impl/SAML1ArtifactEncoder.cpp | 6 +++++- saml/saml1/binding/impl/SAML1MessageDecoder.cpp | 5 +++++ saml/saml1/binding/impl/SAML1POSTEncoder.cpp | 6 +++++- saml/saml1/binding/impl/SAML1SOAPEncoder.cpp | 4 ++++ saml/saml2/binding/SAML2MessageDecoder.h | 3 ++- saml/saml2/binding/impl/SAML2ArtifactEncoder.cpp | 6 +++++- saml/saml2/binding/impl/SAML2ECPEncoder.cpp | 4 ++++ saml/saml2/binding/impl/SAML2MessageDecoder.cpp | 7 ++++++- saml/saml2/binding/impl/SAML2POSTEncoder.cpp | 6 +++++- saml/saml2/binding/impl/SAML2RedirectEncoder.cpp | 6 +++++- saml/saml2/binding/impl/SAML2SOAPEncoder.cpp | 4 ++++ 16 files changed, 78 insertions(+), 10 deletions(-) diff --git a/saml/binding/MessageDecoder.h b/saml/binding/MessageDecoder.h index 1667a10..bbe176e 100644 --- a/saml/binding/MessageDecoder.h +++ b/saml/binding/MessageDecoder.h @@ -1,5 +1,5 @@ /* - * Copyright 2001-2009 Internet2 + * Copyright 2001-2010 Internet2 * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -61,6 +61,13 @@ namespace opensaml { virtual ~MessageDecoder(); /** + * Returns identifier for the protocol family associated with the decoder. + * + * @return a protocol family identifier, or nullptr + */ + virtual const XMLCh* getProtocolFamily() 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 5601568..095a523 100644 --- a/saml/binding/MessageEncoder.h +++ b/saml/binding/MessageEncoder.h @@ -65,6 +65,13 @@ namespace opensaml { virtual bool isUserAgentPresent() const; /** + * Returns identifier for the protocol family associated with the encoder. + * + * @return a protocol family identifier, or nullptr + */ + virtual const XMLCh* getProtocolFamily() 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 d5f223d..4ff6c79 100644 --- a/saml/binding/impl/MessageDecoder.cpp +++ b/saml/binding/impl/MessageDecoder.cpp @@ -74,6 +74,11 @@ MessageDecoder::~MessageDecoder() { } +const XMLCh* MessageDecoder::getProtocolFamily() const +{ + return nullptr; +} + bool MessageDecoder::isUserAgentPresent() const { return true; diff --git a/saml/binding/impl/MessageEncoder.cpp b/saml/binding/impl/MessageEncoder.cpp index c4f3e69..035ad55 100644 --- a/saml/binding/impl/MessageEncoder.cpp +++ b/saml/binding/impl/MessageEncoder.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2001-2009 Internet2 + * Copyright 2001-2010 Internet2 * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -71,6 +71,11 @@ MessageEncoder::~MessageEncoder() { } +const XMLCh* MessageEncoder::getProtocolFamily() const +{ + return nullptr; +} + bool MessageEncoder::isCompact() const { return false; diff --git a/saml/saml1/binding/SAML1MessageDecoder.h b/saml/saml1/binding/SAML1MessageDecoder.h index 2346624..7eda2e1 100644 --- a/saml/saml1/binding/SAML1MessageDecoder.h +++ b/saml/saml1/binding/SAML1MessageDecoder.h @@ -1,5 +1,5 @@ /* - * Copyright 2001-2009 Internet2 + * Copyright 2001-2010 Internet2 * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -39,6 +39,7 @@ namespace opensaml { virtual ~SAML1MessageDecoder(); public: + const XMLCh* getProtocolFamily() const; void extractMessageDetails ( const xmltooling::XMLObject& message, const xmltooling::GenericRequest& genericRequest, diff --git a/saml/saml1/binding/impl/SAML1ArtifactEncoder.cpp b/saml/saml1/binding/impl/SAML1ArtifactEncoder.cpp index 5ab34c5..99c1432 100644 --- a/saml/saml1/binding/impl/SAML1ArtifactEncoder.cpp +++ b/saml/saml1/binding/impl/SAML1ArtifactEncoder.cpp @@ -51,7 +51,11 @@ namespace opensaml { public: SAML1ArtifactEncoder() {} virtual ~SAML1ArtifactEncoder() {} - + + const XMLCh* getProtocolFamily() const { + return samlconstants::SAML11_PROTOCOL_ENUM; + } + long encode( GenericResponse& genericResponse, XMLObject* xmlObject, diff --git a/saml/saml1/binding/impl/SAML1MessageDecoder.cpp b/saml/saml1/binding/impl/SAML1MessageDecoder.cpp index 842b52c..97a681e 100644 --- a/saml/saml1/binding/impl/SAML1MessageDecoder.cpp +++ b/saml/saml1/binding/impl/SAML1MessageDecoder.cpp @@ -46,6 +46,11 @@ SAML1MessageDecoder::~SAML1MessageDecoder() { } +const XMLCh* SAML1MessageDecoder::getProtocolFamily() const +{ + return samlconstants::SAML11_PROTOCOL_ENUM; +} + void SAML1MessageDecoder::extractMessageDetails( const XMLObject& message, const GenericRequest& req, const XMLCh* protocol, SecurityPolicy& policy ) const diff --git a/saml/saml1/binding/impl/SAML1POSTEncoder.cpp b/saml/saml1/binding/impl/SAML1POSTEncoder.cpp index d649db7..73dc625 100644 --- a/saml/saml1/binding/impl/SAML1POSTEncoder.cpp +++ b/saml/saml1/binding/impl/SAML1POSTEncoder.cpp @@ -53,7 +53,11 @@ namespace opensaml { public: SAML1POSTEncoder(const DOMElement* e, const XMLCh* ns); virtual ~SAML1POSTEncoder() {} - + + const XMLCh* getProtocolFamily() const { + return samlconstants::SAML11_PROTOCOL_ENUM; + } + long encode( GenericResponse& genericResponse, XMLObject* xmlObject, diff --git a/saml/saml1/binding/impl/SAML1SOAPEncoder.cpp b/saml/saml1/binding/impl/SAML1SOAPEncoder.cpp index b41f196..4aef15f 100644 --- a/saml/saml1/binding/impl/SAML1SOAPEncoder.cpp +++ b/saml/saml1/binding/impl/SAML1SOAPEncoder.cpp @@ -54,6 +54,10 @@ namespace opensaml { return false; } + const XMLCh* getProtocolFamily() const { + return samlconstants::SAML11_PROTOCOL_ENUM; + } + long encode( GenericResponse& genericResponse, XMLObject* xmlObject, diff --git a/saml/saml2/binding/SAML2MessageDecoder.h b/saml/saml2/binding/SAML2MessageDecoder.h index 7932735..2790ab3 100644 --- a/saml/saml2/binding/SAML2MessageDecoder.h +++ b/saml/saml2/binding/SAML2MessageDecoder.h @@ -1,5 +1,5 @@ /* - * Copyright 2001-2009 Internet2 + * Copyright 2001-2010 Internet2 * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -38,6 +38,7 @@ namespace opensaml { virtual ~SAML2MessageDecoder(); public: + const XMLCh* getProtocolFamily() const; void extractMessageDetails ( const xmltooling::XMLObject& message, const xmltooling::GenericRequest& genericRequest, diff --git a/saml/saml2/binding/impl/SAML2ArtifactEncoder.cpp b/saml/saml2/binding/impl/SAML2ArtifactEncoder.cpp index a6b7454..138fbd2 100644 --- a/saml/saml2/binding/impl/SAML2ArtifactEncoder.cpp +++ b/saml/saml2/binding/impl/SAML2ArtifactEncoder.cpp @@ -55,7 +55,11 @@ namespace opensaml { public: SAML2ArtifactEncoder(const DOMElement* e, const XMLCh* ns); virtual ~SAML2ArtifactEncoder() {} - + + const XMLCh* getProtocolFamily() const { + return samlconstants::SAML20P_NS; + } + long encode( GenericResponse& genericResponse, XMLObject* xmlObject, diff --git a/saml/saml2/binding/impl/SAML2ECPEncoder.cpp b/saml/saml2/binding/impl/SAML2ECPEncoder.cpp index 10e6252..36c0fce 100644 --- a/saml/saml2/binding/impl/SAML2ECPEncoder.cpp +++ b/saml/saml2/binding/impl/SAML2ECPEncoder.cpp @@ -64,6 +64,10 @@ namespace opensaml { delete m_idpList; } + const XMLCh* getProtocolFamily() const { + return samlconstants::SAML20P_NS; + } + long encode( GenericResponse& genericResponse, XMLObject* xmlObject, diff --git a/saml/saml2/binding/impl/SAML2MessageDecoder.cpp b/saml/saml2/binding/impl/SAML2MessageDecoder.cpp index 23191df..05253b2 100644 --- a/saml/saml2/binding/impl/SAML2MessageDecoder.cpp +++ b/saml/saml2/binding/impl/SAML2MessageDecoder.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2001-2009 Internet2 + * Copyright 2001-2010 Internet2 * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -46,6 +46,11 @@ SAML2MessageDecoder::~SAML2MessageDecoder() { } +const XMLCh* SAML2MessageDecoder::getProtocolFamily() const +{ + return samlconstants::SAML20P_NS; +} + void SAML2MessageDecoder::extractMessageDetails( const XMLObject& message, const GenericRequest& request, const XMLCh* protocol, SecurityPolicy& policy ) const diff --git a/saml/saml2/binding/impl/SAML2POSTEncoder.cpp b/saml/saml2/binding/impl/SAML2POSTEncoder.cpp index fde133c..53f08cf 100644 --- a/saml/saml2/binding/impl/SAML2POSTEncoder.cpp +++ b/saml/saml2/binding/impl/SAML2POSTEncoder.cpp @@ -55,7 +55,11 @@ namespace opensaml { public: SAML2POSTEncoder(const DOMElement* e, const XMLCh* ns, bool simple=false); virtual ~SAML2POSTEncoder() {} - + + const XMLCh* getProtocolFamily() const { + return samlconstants::SAML20P_NS; + } + long encode( GenericResponse& genericResponse, XMLObject* xmlObject, diff --git a/saml/saml2/binding/impl/SAML2RedirectEncoder.cpp b/saml/saml2/binding/impl/SAML2RedirectEncoder.cpp index b40cb8b..616d98f 100644 --- a/saml/saml2/binding/impl/SAML2RedirectEncoder.cpp +++ b/saml/saml2/binding/impl/SAML2RedirectEncoder.cpp @@ -57,7 +57,11 @@ namespace opensaml { bool isCompact() const { return true; } - + + const XMLCh* getProtocolFamily() const { + return samlconstants::SAML20P_NS; + } + long encode( GenericResponse& genericResponse, XMLObject* xmlObject, diff --git a/saml/saml2/binding/impl/SAML2SOAPEncoder.cpp b/saml/saml2/binding/impl/SAML2SOAPEncoder.cpp index e136d92..f9a2e1c 100644 --- a/saml/saml2/binding/impl/SAML2SOAPEncoder.cpp +++ b/saml/saml2/binding/impl/SAML2SOAPEncoder.cpp @@ -54,6 +54,10 @@ namespace opensaml { return false; } + const XMLCh* getProtocolFamily() const { + return samlconstants::SAML20P_NS; + } + long encode( GenericResponse& genericResponse, XMLObject* xmlObject, -- 2.1.4