2 * Copyright 2001-2009 Internet2
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
18 * MetadataExtSchemaValidators.cpp
20 * Schema-based validators for Shibboleth metadata extension classes.
24 #include "exceptions.h"
25 #include "metadata/MetadataExt.h"
27 #include <saml/SAMLConfig.h>
28 #include <saml/saml2/metadata/MetadataProvider.h>
29 #include <xmltooling/validation/Validator.h>
30 #include <xmltooling/validation/ValidatorSuite.h>
32 using namespace shibsp;
33 using namespace opensaml::saml2md;
34 using namespace xmltooling;
37 using shibspconstants::SHIBMD_NS;
40 XMLOBJECTVALIDATOR_SIMPLE(SHIBSP_DLLLOCAL,Scope);
42 BEGIN_XMLOBJECTVALIDATOR(SHIBSP_DLLLOCAL,KeyAuthority);
43 XMLOBJECTVALIDATOR_NONEMPTY(KeyAuthority,KeyInfo);
44 END_XMLOBJECTVALIDATOR;
46 SHIBSP_DLLLOCAL PluginManager<MetadataProvider,string,const DOMElement*>::Factory DynamicMetadataProviderFactory;
49 #define REGISTER_ELEMENT(cname) \
50 q=xmltooling::QName(SHIBMD_NS,cname::LOCAL_NAME); \
51 XMLObjectBuilder::registerBuilder(q,new cname##Builder()); \
52 SchemaValidators.registerValidator(q,new cname##SchemaValidator())
54 void shibsp::registerMetadataExtClasses() {
56 REGISTER_ELEMENT(Scope);
57 REGISTER_ELEMENT(KeyAuthority);
59 opensaml::SAMLConfig::getConfig().MetadataProviderManager.registerFactory(DYNAMIC_METADATA_PROVIDER, DynamicMetadataProviderFactory);