+ BEGIN_XMLOBJECT(SAML_API,EntityAttributes,xmltooling::XMLObject,SAML Metadata Extension for Entity Attributes element);
+ DECL_TYPED_FOREIGN_CHILDREN(Attribute,saml2);
+ DECL_TYPED_FOREIGN_CHILDREN(Assertion,saml2);
+ /** EntityAttributesType local name */
+ static const XMLCh TYPE_NAME[];
+ END_XMLOBJECT;
+
+ /**
+ * Predicate to test a role for validity and protocol support.
+ */
+ class isValidForProtocol
+ {
+ public:
+ /**
+ * Constructor.
+ *
+ * @param protocol support constant to test for
+ */
+ isValidForProtocol(const XMLCh* protocol) : m_time(time(NULL)), m_protocol(protocol) {
+ }
+
+ /**
+ * Returns true iff the supplied role is valid now and supports the right protocol.
+ *
+ * @param role role to test
+ * @return result of predicate
+ */
+ bool operator()(const RoleDescriptor* role) const {
+ return role ? (role->isValid(m_time) && role->hasSupport(m_protocol)) : false;
+ }
+
+ private:
+ time_t m_time;
+ const XMLCh* m_protocol;
+ };
+
+ /**
+ * Predicate to test a role for type equivalence, validity, and protocol support.
+ */
+ class ofTypeValidForProtocol : public isValidForProtocol, public xmltooling::hasSchemaType
+ {
+ public:
+ /**
+ * Constructor.
+ *
+ * @param q schema type to test for
+ * @param protocol support constant to test for
+ */
+ ofTypeValidForProtocol(const xmltooling::QName& q, const XMLCh* protocol)
+ : isValidForProtocol(protocol), xmltooling::hasSchemaType(q) {
+ }
+
+ /**
+ * Returns true iff the supplied role is of the right type, valid now, and supports the right protocol.
+ *
+ * @param role role to test
+ * @return result of predicate
+ */
+ bool operator()(const RoleDescriptor* role) const {
+ return xmltooling::hasSchemaType::operator()(role) && isValidForProtocol::operator()(role);
+ }
+ };
+