+ for_each(
+ group->getEntitiesDescriptors().begin(), group->getEntitiesDescriptors().end(),
+ lambda::bind(&DiscoverableMetadataProvider::discoGroup, this, boost::ref(s), _1, boost::ref(first))
+ );
+ for_each(
+ group->getEntityDescriptors().begin(), group->getEntityDescriptors().end(),
+ lambda::bind(&DiscoverableMetadataProvider::discoEntity, this, boost::ref(s), _1, boost::ref(first))
+ );
+ }
+}
+
+void DiscoverableMetadataProvider::discoEntityAttributes(std::string& s, const EntityAttributes& ea, bool& first) const
+{
+ discoAttributes(s, ea.getAttributes(), first);
+ const vector<saml2::Assertion*>& tokens = ea.getAssertions();
+ for (vector<saml2::Assertion*>::const_iterator t = tokens.begin(); t != tokens.end(); ++t) {
+ const vector<AttributeStatement*> statements = const_cast<const saml2::Assertion*>(*t)->getAttributeStatements();
+ for (vector<AttributeStatement*>::const_iterator st = statements.begin(); st != statements.end(); ++st) {
+ discoAttributes(s, const_cast<const AttributeStatement*>(*st)->getAttributes(), first);
+ }
+ }
+}
+
+void DiscoverableMetadataProvider::discoAttributes(std::string& s, const vector<Attribute*>& attrs, bool& first) const
+{
+ for (indirect_iterator<vector<Attribute*>::const_iterator> a = make_indirect_iterator(attrs.begin());
+ a != make_indirect_iterator(attrs.end()); ++a) {
+
+ if (first) {
+ s += ",\n \"EntityAttributes\": [";
+ first = false;
+ }
+ else {
+ s += ',';
+ }