https://issues.shibboleth.net/jira/browse/SSPCPP-304
[shibboleth/cpp-opensaml.git] / saml / saml2 / metadata / Metadata.h
index bbc097e..a213434 100644 (file)
@@ -1,5 +1,5 @@
 /*
- *  Copyright 2001-2009 Internet2
+ *  Copyright 2001-2010 Internet2
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
 #define __saml2_metadata_h__
 
 #include <saml/saml2/core/Assertions.h>
-#include <xmltooling/util/Predicates.h>
 
 #include <ctime>
+#include <xercesc/util/XMLUniDefs.hpp>
+#include <xmltooling/util/Predicates.h>
+
 
 #define DECL_SAML2MDOBJECTBUILDER(cname) \
     DECL_XMLOBJECTBUILDER(SAML_API,cname,samlconstants::SAML20MD_NS,samlconstants::SAML20MD_PREFIX)
 
+namespace xmltooling {
+    class XMLTOOL_API Credential;
+    class XMLTOOL_API CredentialResolver;
+}
+
 namespace xmlencryption {
     class XMLTOOL_API EncryptionMethod;
 };
@@ -43,6 +50,9 @@ namespace opensaml {
      */
     namespace saml2md {
 
+        class SAML_API DigestMethod;
+        class SAML_API SigningMethod;
+
         /**
          * Base class for metadata objects that feature a cacheDuration attribute.
          */
@@ -67,7 +77,7 @@ namespace opensaml {
             DECL_DATETIME_ATTRIB(ValidUntil,VALIDUNTIL);
             /** Returns true iff the object is valid at the current time. */
             bool isValid() const {
-                return time(NULL) <= getValidUntilEpoch();
+                return time(nullptr) <= getValidUntilEpoch();
             }
             /** Returns true iff the object is valid at the supplied time. */
             bool isValid(time_t t) const {
@@ -179,6 +189,12 @@ namespace opensaml {
             DECL_TYPED_CHILDREN(KeyDescriptor);
             DECL_TYPED_CHILD(Organization);
             DECL_TYPED_CHILDREN(ContactPerson);
+            /** Returns the first digest method supported by the role and the underlying implementation, if any. */
+            virtual const DigestMethod* getDigestMethod() const;
+            /** Returns the first signing method supported by the role and the underlying implementation, if any, along with a matching credential. */
+            virtual std::pair<const SigningMethod*,const xmltooling::Credential*> getSigningMethod(
+                const xmltooling::CredentialResolver& resolver, xmltooling::CredentialCriteria& cc
+                ) const;
         END_XMLOBJECT;
 
         BEGIN_XMLOBJECT2(SAML_API,RoleDescriptorType,RoleDescriptor,xmltooling::ElementExtensibleXMLObject,SAML 2.0 RoleDescriptor extension);
@@ -393,6 +409,20 @@ namespace opensaml {
             static const XMLCh TYPE_NAME[];
         END_XMLOBJECT;
 
+        BEGIN_XMLOBJECT(SAML_API,DigestMethod,xmltooling::ElementExtensibleXMLObject,SAML Metadata Extension for Algorithm Support DigestMethod element);
+            DECL_STRING_ATTRIB(Algorithm,ALGORITHM);
+            /** DigestMethodType local name */
+            static const XMLCh TYPE_NAME[];
+        END_XMLOBJECT;
+
+        BEGIN_XMLOBJECT(SAML_API,SigningMethod,xmltooling::ElementExtensibleXMLObject,SAML Metadata Extension for Algorithm Support SigningMethod element);
+            DECL_STRING_ATTRIB(Algorithm,ALGORITHM);
+            DECL_INTEGER_ATTRIB(MinKeySize,MINKEYSIZE);
+            DECL_INTEGER_ATTRIB(MaxKeySize,MAXKEYSIZE);
+            /** SigningMethodType local name */
+            static const XMLCh TYPE_NAME[];
+        END_XMLOBJECT;
+
         /**
          * Predicate to test a role for validity and protocol support.
          */
@@ -404,7 +434,7 @@ namespace opensaml {
              *
              * @param protocol  support constant to test for
              */
-            isValidForProtocol(const XMLCh* protocol) : m_time(time(NULL)), m_protocol(protocol) {
+            isValidForProtocol(const XMLCh* protocol) : m_time(time(nullptr)), m_protocol(protocol) {
             }
 
             /**
@@ -491,6 +521,8 @@ namespace opensaml {
         DECL_XMLOBJECTBUILDER(SAML_API,ActionNamespace,samlconstants::SAML20MD_QUERY_EXT_NS,samlconstants::SAML20MD_QUERY_EXT_PREFIX);
         DECL_XMLOBJECTBUILDER(SAML_API,SourceID,samlconstants::SAML1MD_NS,samlconstants::SAML1MD_PREFIX);
         DECL_XMLOBJECTBUILDER(SAML_API,EntityAttributes,samlconstants::SAML20MD_ENTITY_ATTRIBUTE_NS,samlconstants::SAML20MD_ENTITY_ATTRIBUTE_PREFIX);
+        DECL_XMLOBJECTBUILDER(SAML_API,DigestMethod,samlconstants::SAML20MD_ALGSUPPORT_NS,samlconstants::SAML20MD_ALGSUPPORT_PREFIX);
+        DECL_XMLOBJECTBUILDER(SAML_API,SigningMethod,samlconstants::SAML20MD_ALGSUPPORT_NS,samlconstants::SAML20MD_ALGSUPPORT_PREFIX);
 
         /**
          * Builder for localizedNameType objects.
@@ -506,11 +538,11 @@ namespace opensaml {
 #else
             virtual xmltooling::XMLObject* buildObject(
 #endif
-                const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix=NULL, const xmltooling::QName* schemaType=NULL
+                const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix=nullptr, const xmltooling::QName* schemaType=nullptr
                 ) const;
 
             /** Singleton builder. */
-            static localizedNameType* buildlocalizedNameType(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix=NULL) {
+            static localizedNameType* buildlocalizedNameType(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix=nullptr) {
                 const localizedNameTypeBuilder* b = dynamic_cast<const localizedNameTypeBuilder*>(
                     XMLObjectBuilder::getBuilder(xmltooling::QName(samlconstants::SAML20MD_NS,localizedNameType::TYPE_NAME))
                     );
@@ -540,11 +572,11 @@ namespace opensaml {
 #else
             virtual xmltooling::XMLObject* buildObject(
 #endif
-                const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix=NULL, const xmltooling::QName* schemaType=NULL
+                const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix=nullptr, const xmltooling::QName* schemaType=nullptr
                 ) const;
 
             /** Singleton builder. */
-            static localizedURIType* buildlocalizedURIType(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix=NULL) {
+            static localizedURIType* buildlocalizedURIType(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix=nullptr) {
                 const localizedURITypeBuilder* b = dynamic_cast<const localizedURITypeBuilder*>(
                     XMLObjectBuilder::getBuilder(xmltooling::QName(samlconstants::SAML20MD_NS,localizedURIType::TYPE_NAME))
                     );
@@ -574,11 +606,11 @@ namespace opensaml {
 #else
             virtual xmltooling::XMLObject* buildObject(
 #endif
-                const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix=NULL, const xmltooling::QName* schemaType=NULL
+                const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix=nullptr, const xmltooling::QName* schemaType=nullptr
                 ) const;
 
             /** Singleton builder. */
-            static EndpointType* buildEndpointType(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix=NULL) {
+            static EndpointType* buildEndpointType(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix=nullptr) {
                 const EndpointTypeBuilder* b = dynamic_cast<const EndpointTypeBuilder*>(
                     XMLObjectBuilder::getBuilder(xmltooling::QName(samlconstants::SAML20MD_NS,EndpointType::TYPE_NAME))
                     );
@@ -608,11 +640,11 @@ namespace opensaml {
 #else
             virtual xmltooling::XMLObject* buildObject(
 #endif
-                const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix=NULL, const xmltooling::QName* schemaType=NULL
+                const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix=nullptr, const xmltooling::QName* schemaType=nullptr
                 ) const;
 
             /** Singleton builder. */
-            static IndexedEndpointType* buildIndexedEndpointType(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix=NULL) {
+            static IndexedEndpointType* buildIndexedEndpointType(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix=nullptr) {
                 const IndexedEndpointTypeBuilder* b = dynamic_cast<const IndexedEndpointTypeBuilder*>(
                     XMLObjectBuilder::getBuilder(xmltooling::QName(samlconstants::SAML20MD_NS,IndexedEndpointType::TYPE_NAME))
                     );
@@ -642,7 +674,7 @@ namespace opensaml {
 #else
             virtual xmltooling::XMLObject* buildObject(
 #endif
-                const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix=NULL, const xmltooling::QName* schemaType=NULL
+                const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix=nullptr, const xmltooling::QName* schemaType=nullptr
                 ) const;
 
             /** Singleton builder. */
@@ -689,7 +721,7 @@ namespace opensaml {
 #else
             virtual xmltooling::XMLObject* buildObject(
 #endif
-                const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix=NULL, const xmltooling::QName* schemaType=NULL
+                const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix=nullptr, const xmltooling::QName* schemaType=nullptr
                 ) const;
 
             /** Singleton builder. */
@@ -736,7 +768,7 @@ namespace opensaml {
 #else
             virtual xmltooling::XMLObject* buildObject(
 #endif
-                const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix=NULL, const xmltooling::QName* schemaType=NULL
+                const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix=nullptr, const xmltooling::QName* schemaType=nullptr
                 ) const;
 
             /** Singleton builder. */
@@ -783,7 +815,7 @@ namespace opensaml {
 #else
             virtual xmltooling::XMLObject* buildObject(
 #endif
-                const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix=NULL, const xmltooling::QName* schemaType=NULL
+                const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix=nullptr, const xmltooling::QName* schemaType=nullptr
                 ) const;
 
             /** Singleton builder. */