X-Git-Url: http://www.project-moonshot.org/gitweb/?p=shibboleth%2Fcpp-opensaml.git;a=blobdiff_plain;f=saml%2FSAMLConfig.cpp;h=43deb15e24317089056fa1189bd4dccaaef4bcbb;hp=5842713815b92df0b255a4f670f6d7254146eaec;hb=6dde4bb7afc0c3b862cfad5cd0c7330814c8421b;hpb=c94a8ec50180f280a81259fa13a23eb3a45e087f diff --git a/saml/SAMLConfig.cpp b/saml/SAMLConfig.cpp index 5842713..43deb15 100644 --- a/saml/SAMLConfig.cpp +++ b/saml/SAMLConfig.cpp @@ -61,6 +61,10 @@ #include #include +#include +#include +#include + #include #include #include @@ -69,6 +73,8 @@ using namespace opensaml; using namespace xmlsignature; using namespace xmltooling::logging; using namespace xmltooling; +using namespace boost::lambda; +using namespace boost; using namespace std; // Expose entry points when used as an extension library @@ -114,6 +120,7 @@ SAMLConfig::SAMLConfig() : m_artifactMap(nullptr) SAMLConfig::~SAMLConfig() { + delete m_artifactMap; } ArtifactMap* SAMLConfig::getArtifactMap() const @@ -287,15 +294,19 @@ using namespace saml2md; void opensaml::annotateException(XMLToolingException* e, const EntityDescriptor* entity, const Status* status, bool rethrow) { + time_t now = time(nullptr); const RoleDescriptor* role = nullptr; + static bool (TimeBoundSAMLObject::* isValid)(time_t) const = &TimeBoundSAMLObject::isValid; + if (entity) { - const list& roles=entity->getOrderedChildren(); - for (list::const_iterator child=roles.begin(); !role && child!=roles.end(); ++child) { - role=dynamic_cast(*child); - if (role && !role->isValid()) - role = nullptr; - } + const XMLObject* r = find_if( + entity->getOrderedChildren(), + (ll_dynamic_cast(_1) != nullptr && lambda::bind(isValid, ll_dynamic_cast(_1), now)) + ); + if (r) + role = dynamic_cast(r); } + annotateException(e, role, status, rethrow); }