[cpp-sp COMMIT] /branches/REL_2/shibsp/handler/impl/MetadataGenerator.cpp
noreply at shibboleth.net
noreply at shibboleth.net
Thu Jul 5 16:52:17 EDT 2012
Author: scantor
Date: Thu Jul 5 16:52:16 2012
New Revision: 3723
URL: http://svn.shibboleth.net/view/cpp-sp?rev=3723&view=rev
Log:
https://issues.shibboleth.net/jira/browse/SSPCPP-366
Modified:
branches/REL_2/shibsp/handler/impl/MetadataGenerator.cpp
Modified: branches/REL_2/shibsp/handler/impl/MetadataGenerator.cpp
URL: http://svn.shibboleth.net/view/cpp-sp/branches/REL_2/shibsp/handler/impl/MetadataGenerator.cpp?rev=3723&r1=3722&r2=3723&view=diff
==============================================================================
--- branches/REL_2/shibsp/handler/impl/MetadataGenerator.cpp (original)
+++ branches/REL_2/shibsp/handler/impl/MetadataGenerator.cpp Thu Jul 5 16:52:16 2012
@@ -45,12 +45,14 @@
# include <saml/saml2/metadata/Metadata.h>
# include <saml/saml2/metadata/MetadataProvider.h>
# include <xmltooling/XMLToolingConfig.h>
+# include <xmltooling/encryption/Encryption.h>
# include <xmltooling/security/Credential.h>
# include <xmltooling/security/CredentialCriteria.h>
# include <xmltooling/security/SecurityHelper.h>
# include <xmltooling/signature/Signature.h>
# include <xmltooling/util/ParserPool.h>
# include <xmltooling/util/PathResolver.h>
+# include <xsec/dsig/DSIGConstants.hpp>
# include <xercesc/framework/LocalFileInputSource.hpp>
# include <xercesc/framework/Wrapper4InputSource.hpp>
#endif
@@ -61,6 +63,8 @@
using namespace opensaml::saml2md;
using namespace opensaml;
using namespace xmlsignature;
+using xmlencryption::EncryptionMethod;
+using xmlencryption::EncryptionMethodBuilder;
#endif
using namespace xmltooling;
using namespace boost;
@@ -91,6 +95,39 @@
) const;
#ifndef SHIBSP_LITE
+ void registerEncryptionMethod(const XMLCh* alg) {
+ if (XMLToolingConfig::getConfig().isXMLAlgorithmSupported(alg, XMLToolingConfig::ALGTYPE_ENCRYPT) ||
+ XMLToolingConfig::getConfig().isXMLAlgorithmSupported(alg, XMLToolingConfig::ALGTYPE_KEYENCRYPT) ||
+ XMLToolingConfig::getConfig().isXMLAlgorithmSupported(alg, XMLToolingConfig::ALGTYPE_KEYAGREE)) {
+ // Non-default builder needed to override namespace/prefix.
+ if (!m_encryptionBuilder)
+ m_encryptionBuilder = XMLObjectBuilder::getBuilder(xmltooling::QName(samlconstants::SAML20MD_NS, EncryptionMethod::LOCAL_NAME));
+ EncryptionMethod* em = dynamic_cast<EncryptionMethod*>(
+ m_encryptionBuilder->buildObject(
+ samlconstants::SAML20MD_NS, EncryptionMethod::LOCAL_NAME, samlconstants::SAML20MD_PREFIX
+ )
+ );
+ em->setAlgorithm(alg);
+ m_encryptions.push_back(em);
+ }
+ }
+
+ void registerDigestMethod(const XMLCh* alg) {
+ if (XMLToolingConfig::getConfig().isXMLAlgorithmSupported(alg, XMLToolingConfig::ALGTYPE_DIGEST)) {
+ DigestMethod* dm = DigestMethodBuilder::buildDigestMethod();
+ dm->setAlgorithm(alg);
+ m_digests.push_back(dm);
+ }
+ }
+
+ void registerSigningMethod(const XMLCh* alg) {
+ if (XMLToolingConfig::getConfig().isXMLAlgorithmSupported(alg, XMLToolingConfig::ALGTYPE_SIGN)) {
+ SigningMethod* sm = SigningMethodBuilder::buildSigningMethod();
+ sm->setAlgorithm(alg);
+ m_signings.push_back(sm);
+ }
+ }
+
string m_salt;
short m_http,m_https;
vector<string> m_bases;
@@ -101,6 +138,10 @@
ptr_vector<NameIDFormat> m_formats;
ptr_vector<RequestedAttribute> m_reqAttrs;
ptr_vector<AttributeConsumingService> m_attrConsumers;
+ ptr_vector<EncryptionMethod> m_encryptions;
+ ptr_vector<DigestMethod> m_digests;
+ ptr_vector<SigningMethod> m_signings;
+ const XMLObjectBuilder* m_encryptionBuilder;
#endif
};
@@ -118,7 +159,7 @@
MetadataGenerator::MetadataGenerator(const DOMElement* e, const char* appId)
: SecuredHandler(e, Category::getInstance(SHIBSP_LOGCAT".MetadataGenerator"))
#ifndef SHIBSP_LITE
- ,m_http(0), m_https(0)
+ ,m_http(0), m_https(0), m_encryptionBuilder(nullptr)
#endif
{
string address(appId);
@@ -126,7 +167,7 @@
setAddress(address.c_str());
#ifndef SHIBSP_LITE
- static XMLCh EndpointBase[] = UNICODE_LITERAL_12(E,n,d,p,o,i,n,t,B,a,s,e);
+ static XMLCh EndpointBase[] = UNICODE_LITERAL_12(E,n,d,p,o,i,n,t,B,a,s,e);
pair<bool,const char*> salt = getString("salt");
if (salt.first)
@@ -205,6 +246,27 @@
m_log.warn("skipping duplicate EntityAttributes element");
}
}
+ else {
+ EncryptionMethod* em = dynamic_cast<EncryptionMethod*>(child.get());
+ if (em) {
+ m_encryptions.push_back(em);
[... 136 lines stripped ...]
More information about the commits
mailing list