CPPOST-95 - Add MD RPI extension implementation to metadata classes.
[shibboleth/cpp-opensaml.git] / saml / saml2 / metadata / impl / MetadataSchemaValidators.cpp
index 7258fb8..44ff903 100644 (file)
@@ -1,17 +1,21 @@
-/*
- *  Copyright 2001-2010 Internet2
+/**
+ * Licensed to the University Corporation for Advanced Internet
+ * Development, Inc. (UCAID) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for
+ * additional information regarding copyright ownership.
  *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * UCAID licenses this file to you under the Apache License,
+ * Version 2.0 (the "License"); you may not use this file except
+ * in compliance with the License. You may obtain a copy of the
+ * License at
  *
- *     http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
  *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
+ * either express or implied. See the License for the specific
+ * language governing permissions and limitations under the License.
  */
 
 /**
@@ -38,6 +42,7 @@ using samlconstants::SAML20MD_QUERY_EXT_NS;
 using samlconstants::SAML20MD_ALGSUPPORT_NS;
 using samlconstants::SAML20MD_ENTITY_ATTRIBUTE_NS;
 using samlconstants::SAML20MD_UI_NS;
+using samlconstants::SAML20MD_RPI_NS;
 using samlconstants::SAML1MD_NS;
 using samlconstants::IDP_DISCOVERY_PROTOCOL_NS;
 using samlconstants::SP_REQUEST_INIT_NS;
@@ -317,6 +322,21 @@ namespace opensaml {
         XMLOBJECTVALIDATOR_SIMPLE(SAML_DLLLOCAL,IPHint);
         XMLOBJECTVALIDATOR_SIMPLE(SAML_DLLLOCAL,DomainHint);
         XMLOBJECTVALIDATOR_SIMPLE(SAML_DLLLOCAL,GeolocationHint);
+
+        BEGIN_XMLOBJECTVALIDATOR(SAML_DLLLOCAL,RegistrationInfo);
+            XMLOBJECTVALIDATOR_REQUIRE(RegistrationInfo,RegistrationAuthority);
+        END_XMLOBJECTVALIDATOR;
+
+        BEGIN_XMLOBJECTVALIDATOR(SAML_DLLLOCAL,PublicationInfo);
+            XMLOBJECTVALIDATOR_REQUIRE(PublicationInfo,Publisher);
+        END_XMLOBJECTVALIDATOR;
+
+        BEGIN_XMLOBJECTVALIDATOR(SAML_DLLLOCAL,Publication);
+            XMLOBJECTVALIDATOR_REQUIRE(Publication,Publisher);
+        END_XMLOBJECTVALIDATOR;
+
+        XMLOBJECTVALIDATOR_SIMPLE(SAML_DLLLOCAL,RegistrationPolicy);
+        XMLOBJECTVALIDATOR_SIMPLE(SAML_DLLLOCAL,UsagePolicy);
     };
 };
 
@@ -348,6 +368,24 @@ namespace opensaml {
     q=xmltooling::QName(SAML20MD_UI_NS,cname::TYPE_NAME); \
     XMLObjectBuilder::registerBuilder(q,new cname##Builder());
 
+#define REGISTER_ELEMENT_RPI(cname) \
+    q=xmltooling::QName(SAML20MD_RPI_NS,cname::LOCAL_NAME); \
+    XMLObjectBuilder::registerBuilder(q,new cname##Builder()); \
+    SchemaValidators.registerValidator(q,new cname##SchemaValidator())
+
+#define REGISTER_TYPE_RPI(cname) \
+    q=xmltooling::QName(SAML20MD_RPI_NS,cname::TYPE_NAME); \
+    XMLObjectBuilder::registerBuilder(q,new cname##Builder()); \
+    SchemaValidators.registerValidator(q,new cname##SchemaValidator())
+
+#define REGISTER_ELEMENT_RPI_NOVAL(cname) \
+    q=xmltooling::QName(SAML20MD_RPI_NS,cname::LOCAL_NAME); \
+    XMLObjectBuilder::registerBuilder(q,new cname##Builder());
+
+#define REGISTER_TYPE_RPI_NOVAL(cname) \
+    q=xmltooling::QName(SAML20MD_RPI_NS,cname::TYPE_NAME); \
+    XMLObjectBuilder::registerBuilder(q,new cname##Builder());
+
 void opensaml::saml2md::registerMetadataClasses() {
     xmltooling::QName q;
     REGISTER_ELEMENT(AdditionalMetadataLocation);
@@ -479,4 +517,15 @@ void opensaml::saml2md::registerMetadataClasses() {
     REGISTER_ELEMENT_UI_NOVAL(DiscoHints);
     REGISTER_TYPE_UI_NOVAL(UIInfo);
     REGISTER_TYPE_UI_NOVAL(DiscoHints);
+
+    REGISTER_ELEMENT_RPI(RegistrationInfo);
+    REGISTER_ELEMENT_RPI(RegistrationPolicy);
+    REGISTER_ELEMENT_RPI(PublicationInfo);
+    REGISTER_ELEMENT_RPI(UsagePolicy);
+    REGISTER_ELEMENT_RPI(Publication);
+    REGISTER_TYPE_RPI(RegistrationInfo);
+    REGISTER_TYPE_RPI(PublicationInfo);
+    REGISTER_TYPE_RPI(Publication);
+    REGISTER_ELEMENT_RPI_NOVAL(PublicationPath);
+    REGISTER_TYPE_RPI_NOVAL(PublicationPath);
 }