2 * Licensed to the University Corporation for Advanced Internet
3 * Development, Inc. (UCAID) under one or more contributor license
4 * agreements. See the NOTICE file distributed with this work for
5 * additional information regarding copyright ownership.
7 * UCAID licenses this file to you under the Apache License,
8 * Version 2.0 (the "License"); you may not use this file except
9 * in compliance with the License. You may obtain a copy of the
12 * http://www.apache.org/licenses/LICENSE-2.0
14 * Unless required by applicable law or agreed to in writing,
15 * software distributed under the License is distributed on an
16 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
17 * either express or implied. See the License for the specific
18 * language governing permissions and limitations under the License.
22 * MetadataExtSchemaValidators.cpp
24 * Schema-based validators for Shibboleth metadata extension classes.
28 #include "exceptions.h"
29 #include "metadata/MetadataExt.h"
31 #include <saml/SAMLConfig.h>
32 #include <saml/saml2/metadata/MetadataProvider.h>
33 #include <xmltooling/validation/Validator.h>
34 #include <xmltooling/validation/ValidatorSuite.h>
36 using namespace shibsp;
37 using namespace opensaml::saml2md;
38 using namespace xmltooling;
41 using shibspconstants::SHIBMD_NS;
44 XMLOBJECTVALIDATOR_SIMPLE(SHIBSP_DLLLOCAL,Scope);
46 BEGIN_XMLOBJECTVALIDATOR(SHIBSP_DLLLOCAL,KeyAuthority);
47 XMLOBJECTVALIDATOR_NONEMPTY(KeyAuthority,KeyInfo);
48 END_XMLOBJECTVALIDATOR;
50 SHIBSP_DLLLOCAL PluginManager<MetadataProvider,string,const DOMElement*>::Factory DynamicMetadataProviderFactory;
53 #define REGISTER_ELEMENT(cname) \
54 q=xmltooling::QName(SHIBMD_NS,cname::LOCAL_NAME); \
55 XMLObjectBuilder::registerBuilder(q,new cname##Builder()); \
56 SchemaValidators.registerValidator(q,new cname##SchemaValidator())
58 void shibsp::registerMetadataExtClasses() {
60 REGISTER_ELEMENT(Scope);
61 REGISTER_ELEMENT(KeyAuthority);
63 opensaml::SAMLConfig::getConfig().MetadataProviderManager.registerFactory(DYNAMIC_METADATA_PROVIDER, DynamicMetadataProviderFactory);