X-Git-Url: http://www.project-moonshot.org/gitweb/?a=blobdiff_plain;f=saml%2Fbinding%2Fimpl%2FMessageEncoder.cpp;h=88f41da283def4d43495ee2b8fe95f32ab421218;hb=c072b75e6f6e05e24a1c35b952008b38d0d375c1;hp=74e9a8ac175169177a4c335a121fdbff1e139c9d;hpb=e614d5f693d82e493d3fb189ece2fe2709ed07e0;p=shibboleth%2Fcpp-opensaml.git diff --git a/saml/binding/impl/MessageEncoder.cpp b/saml/binding/impl/MessageEncoder.cpp index 74e9a8a..88f41da 100644 --- a/saml/binding/impl/MessageEncoder.cpp +++ b/saml/binding/impl/MessageEncoder.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2001-2006 Internet2 + * Copyright 2001-2009 Internet2 * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -34,15 +34,18 @@ using namespace std; namespace opensaml { namespace saml1p { - SAML_DLLLOCAL PluginManager::Factory SAML1ArtifactEncoderFactory; - SAML_DLLLOCAL PluginManager::Factory SAML1POSTEncoderFactory; + SAML_DLLLOCAL PluginManager< MessageEncoder,string,pair >::Factory SAML1ArtifactEncoderFactory; + SAML_DLLLOCAL PluginManager< MessageEncoder,string,pair >::Factory SAML1POSTEncoderFactory; + SAML_DLLLOCAL PluginManager< MessageEncoder,string,pair >::Factory SAML1SOAPEncoderFactory; }; namespace saml2p { - SAML_DLLLOCAL PluginManager::Factory SAML2ArtifactEncoderFactory; - SAML_DLLLOCAL PluginManager::Factory SAML2POSTEncoderFactory; - SAML_DLLLOCAL PluginManager::Factory SAML2POSTSimpleSignEncoderFactory; - SAML_DLLLOCAL PluginManager::Factory SAML2RedirectEncoderFactory; + SAML_DLLLOCAL PluginManager< MessageEncoder,string,pair >::Factory SAML2ArtifactEncoderFactory; + SAML_DLLLOCAL PluginManager< MessageEncoder,string,pair >::Factory SAML2POSTEncoderFactory; + SAML_DLLLOCAL PluginManager< MessageEncoder,string,pair >::Factory SAML2POSTSimpleSignEncoderFactory; + SAML_DLLLOCAL PluginManager< MessageEncoder,string,pair >::Factory SAML2RedirectEncoderFactory; + SAML_DLLLOCAL PluginManager< MessageEncoder,string,pair >::Factory SAML2SOAPEncoderFactory; + SAML_DLLLOCAL PluginManager< MessageEncoder,string,pair >::Factory SAML2ECPEncoderFactory; }; }; @@ -51,41 +54,21 @@ void SAML_API opensaml::registerMessageEncoders() SAMLConfig& conf=SAMLConfig::getConfig(); conf.MessageEncoderManager.registerFactory(samlconstants::SAML1_PROFILE_BROWSER_ARTIFACT, saml1p::SAML1ArtifactEncoderFactory); conf.MessageEncoderManager.registerFactory(samlconstants::SAML1_PROFILE_BROWSER_POST, saml1p::SAML1POSTEncoderFactory); + conf.MessageEncoderManager.registerFactory(samlconstants::SAML1_BINDING_SOAP, saml1p::SAML1SOAPEncoderFactory); conf.MessageEncoderManager.registerFactory(samlconstants::SAML20_BINDING_HTTP_ARTIFACT, saml2p::SAML2ArtifactEncoderFactory); conf.MessageEncoderManager.registerFactory(samlconstants::SAML20_BINDING_HTTP_POST, saml2p::SAML2POSTEncoderFactory); conf.MessageEncoderManager.registerFactory(samlconstants::SAML20_BINDING_HTTP_POST_SIMPLESIGN, saml2p::SAML2POSTSimpleSignEncoderFactory); conf.MessageEncoderManager.registerFactory(samlconstants::SAML20_BINDING_HTTP_REDIRECT, saml2p::SAML2RedirectEncoderFactory); + conf.MessageEncoderManager.registerFactory(samlconstants::SAML20_BINDING_SOAP, saml2p::SAML2SOAPEncoderFactory); + conf.MessageEncoderManager.registerFactory(samlconstants::SAML20_BINDING_PAOS, saml2p::SAML2ECPEncoderFactory); } -namespace { - class SAML_DLLLOCAL _addcert : public binary_function { - public: - void operator()(X509Data* bag, XSECCryptoX509* cert) const { - safeBuffer& buf=cert->getDEREncodingSB(); - X509Certificate* x=X509CertificateBuilder::buildX509Certificate(); - x->setValue(buf.sbStrToXMLCh()); - bag->getX509Certificates().push_back(x); - } - }; -}; - -Signature* MessageEncoder::buildSignature(const CredentialResolver* credResolver, const XMLCh* sigAlgorithm) const +bool MessageEncoder::isCompact() const { - // Build a Signature. - Signature* sig = SignatureBuilder::buildSignature(); - if (sigAlgorithm) - sig->setSignatureAlgorithm(sigAlgorithm); - sig->setSigningKey(credResolver->getKey()); + return false; +} - // Build KeyInfo. - const vector& certs = credResolver->getCertificates(); - if (!certs.empty()) { - KeyInfo* keyInfo=KeyInfoBuilder::buildKeyInfo(); - X509Data* x509Data=X509DataBuilder::buildX509Data(); - keyInfo->getX509Datas().push_back(x509Data); - for_each(certs.begin(),certs.end(),bind1st(_addcert(),x509Data)); - sig->setKeyInfo(keyInfo); - } - - return sig; +bool MessageEncoder::isUserAgentPresent() const +{ + return true; }