Change license header, remove stale pkg files.
[shibboleth/cpp-opensaml.git] / saml / saml2 / metadata / impl / MetadataSchemaValidators.cpp
index 97e221a..93e0e11 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,9 @@ using samlconstants::SAML20MD_QUERY_EXT_NS;
 using samlconstants::SAML20MD_ALGSUPPORT_NS;
 using samlconstants::SAML20MD_ENTITY_ATTRIBUTE_NS;
 using samlconstants::SAML20MD_UI_NS;
+using samlconstants::SAML1MD_NS;
+using samlconstants::IDP_DISCOVERY_PROTOCOL_NS;
+using samlconstants::SP_REQUEST_INIT_NS;
 
 namespace opensaml {
     namespace saml2md {
@@ -259,6 +266,14 @@ namespace opensaml {
 
         XMLOBJECTVALIDATOR_SIMPLE(SAML_DLLLOCAL,SourceID);
 
+        BEGIN_XMLOBJECTVALIDATOR_SUB(SAML_DLLLOCAL,DiscoveryResponse,IndexedEndpointType);
+            IndexedEndpointTypeSchemaValidator::validate(xmlObject);
+        END_XMLOBJECTVALIDATOR;
+
+        BEGIN_XMLOBJECTVALIDATOR_SUB(SAML_DLLLOCAL,RequestInitiator,EndpointType);
+            EndpointTypeSchemaValidator::validate(xmlObject);
+        END_XMLOBJECTVALIDATOR;
+
         BEGIN_XMLOBJECTVALIDATOR(SAML_DLLLOCAL,EntityAttributes);
             if (!ptr->hasChildren())
                 throw ValidationException("EntityAttributes must contain at least one child element.");
@@ -282,6 +297,11 @@ namespace opensaml {
             XMLOBJECTVALIDATOR_REQUIRE(Description,Lang);
         END_XMLOBJECTVALIDATOR;
 
+        BEGIN_XMLOBJECTVALIDATOR(SAML_DLLLOCAL,Keywords);
+            XMLOBJECTVALIDATOR_REQUIRE(Keywords,TextContent);
+            XMLOBJECTVALIDATOR_REQUIRE(Keywords,Lang);
+        END_XMLOBJECTVALIDATOR;
+
         BEGIN_XMLOBJECTVALIDATOR(SAML_DLLLOCAL,Logo);
             XMLOBJECTVALIDATOR_REQUIRE(Logo,TextContent);
             XMLOBJECTVALIDATOR_REQUIRE_INTEGER(Logo,Height);
@@ -396,10 +416,18 @@ void opensaml::saml2md::registerMetadataClasses() {
     q=xmltooling::QName(SAML20MD_NS,xmlencryption::EncryptionMethod::LOCAL_NAME);
     XMLObjectBuilder::registerBuilder(q,new xmlencryption::EncryptionMethodBuilder());
 
-    q=xmltooling::QName(samlconstants::SAML1MD_NS,SourceID::LOCAL_NAME);
+    q=xmltooling::QName(SAML1MD_NS,SourceID::LOCAL_NAME);
     XMLObjectBuilder::registerBuilder(q,new SourceIDBuilder());
     SchemaValidators.registerValidator(q,new SourceIDSchemaValidator());
 
+    q=xmltooling::QName(IDP_DISCOVERY_PROTOCOL_NS,DiscoveryResponse::LOCAL_NAME);
+    XMLObjectBuilder::registerBuilder(q,new DiscoveryResponseBuilder());
+    SchemaValidators.registerValidator(q,new DiscoveryResponseSchemaValidator());
+
+    q=xmltooling::QName(SP_REQUEST_INIT_NS,RequestInitiator::LOCAL_NAME);
+    XMLObjectBuilder::registerBuilder(q,new RequestInitiatorBuilder());
+    SchemaValidators.registerValidator(q,new RequestInitiatorSchemaValidator());
+
     q=xmltooling::QName(SAML20MD_QUERY_EXT_NS,ActionNamespace::LOCAL_NAME);
     XMLObjectBuilder::registerBuilder(q,new ActionNamespaceBuilder());
     SchemaValidators.registerValidator(q,new ActionNamespaceSchemaValidator());
@@ -442,12 +470,14 @@ void opensaml::saml2md::registerMetadataClasses() {
 
     REGISTER_ELEMENT_UI(DisplayName);
     REGISTER_ELEMENT_UI(Description);
+       REGISTER_ELEMENT_UI(Keywords);
     REGISTER_ELEMENT_UI(Logo);
     REGISTER_ELEMENT_UI(InformationURL);
     REGISTER_ELEMENT_UI(PrivacyStatementURL);
     REGISTER_ELEMENT_UI(IPHint);
     REGISTER_ELEMENT_UI(DomainHint);
     REGISTER_ELEMENT_UI(GeolocationHint);
+       REGISTER_TYPE_UI(Keywords);
     REGISTER_TYPE_UI(Logo);
     REGISTER_ELEMENT_UI_NOVAL(UIInfo);
     REGISTER_ELEMENT_UI_NOVAL(DiscoHints);