Set fourth file version digit to signify rebuild.
[shibboleth/cpp-opensaml.git] / saml / saml2 / metadata / impl / MetadataSchemaValidators.cpp
1 /**
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.
6  *
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
10  * License at
11  *
12  * http://www.apache.org/licenses/LICENSE-2.0
13  *
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.
19  */
20
21 /**
22  * MetadataSchemaValidators.cpp
23  *
24  * Schema-based validators for SAML 2.0 Metadata classes.
25  */
26
27 #include "internal.h"
28 #include "exceptions.h"
29 #include "saml2/metadata/Metadata.h"
30
31 #include <xmltooling/encryption/Encryption.h>
32 #include <xmltooling/validation/Validator.h>
33 #include <xmltooling/validation/ValidatorSuite.h>
34
35 using namespace opensaml::saml2md;
36 using namespace opensaml::saml2;
37 using namespace opensaml;
38 using namespace xmltooling;
39 using namespace std;
40 using samlconstants::SAML20MD_NS;
41 using samlconstants::SAML20MD_QUERY_EXT_NS;
42 using samlconstants::SAML20MD_ALGSUPPORT_NS;
43 using samlconstants::SAML20MD_ENTITY_ATTRIBUTE_NS;
44 using samlconstants::SAML20MD_UI_NS;
45 using samlconstants::SAML1MD_NS;
46 using samlconstants::IDP_DISCOVERY_PROTOCOL_NS;
47 using samlconstants::SP_REQUEST_INIT_NS;
48
49 namespace opensaml {
50     namespace saml2md {
51
52         XMLOBJECTVALIDATOR_SIMPLE(SAML_DLLLOCAL,ActionNamespace);
53         XMLOBJECTVALIDATOR_SIMPLE(SAML_DLLLOCAL,AffiliateMember);
54         XMLOBJECTVALIDATOR_SIMPLE(SAML_DLLLOCAL,AttributeProfile);
55         XMLOBJECTVALIDATOR_SIMPLE(SAML_DLLLOCAL,Company);
56         XMLOBJECTVALIDATOR_SIMPLE(SAML_DLLLOCAL,EmailAddress);
57         XMLOBJECTVALIDATOR_SIMPLE(SAML_DLLLOCAL,GivenName);
58         XMLOBJECTVALIDATOR_SIMPLE(SAML_DLLLOCAL,NameIDFormat);
59         XMLOBJECTVALIDATOR_SIMPLE(SAML_DLLLOCAL,SurName);
60         XMLOBJECTVALIDATOR_SIMPLE(SAML_DLLLOCAL,TelephoneNumber);
61
62         BEGIN_XMLOBJECTVALIDATOR(SAML_DLLLOCAL,localizedNameType);
63             XMLOBJECTVALIDATOR_REQUIRE(localizedNameType,TextContent);
64             XMLOBJECTVALIDATOR_REQUIRE(localizedNameType,Lang);
65         END_XMLOBJECTVALIDATOR;
66
67         BEGIN_XMLOBJECTVALIDATOR(SAML_DLLLOCAL,localizedURIType);
68             XMLOBJECTVALIDATOR_REQUIRE(localizedURIType,TextContent);
69             XMLOBJECTVALIDATOR_REQUIRE(localizedURIType,Lang);
70         END_XMLOBJECTVALIDATOR;
71
72         BEGIN_XMLOBJECTVALIDATOR(SAML_DLLLOCAL,OrganizationName);
73             XMLOBJECTVALIDATOR_REQUIRE(OrganizationName,TextContent);
74             XMLOBJECTVALIDATOR_REQUIRE(OrganizationName,Lang);
75         END_XMLOBJECTVALIDATOR;
76
77         BEGIN_XMLOBJECTVALIDATOR(SAML_DLLLOCAL,OrganizationDisplayName);
78             XMLOBJECTVALIDATOR_REQUIRE(OrganizationDisplayName,TextContent);
79             XMLOBJECTVALIDATOR_REQUIRE(OrganizationDisplayName,Lang);
80         END_XMLOBJECTVALIDATOR;
81
82         BEGIN_XMLOBJECTVALIDATOR(SAML_DLLLOCAL,OrganizationURL);
83             XMLOBJECTVALIDATOR_REQUIRE(OrganizationURL,TextContent);
84             XMLOBJECTVALIDATOR_REQUIRE(OrganizationURL,Lang);
85         END_XMLOBJECTVALIDATOR;
86
87         class SAML_DLLLOCAL checkWildcardNS {
88         public:
89             void operator()(const XMLObject* xmlObject) const {
90                 const XMLCh* ns=xmlObject->getElementQName().getNamespaceURI();
91                 if (XMLString::equals(ns,SAML20MD_NS) || !ns || !*ns) {
92                     throw ValidationException(
93                         "Object contains an illegal extension child element ($1).",
94                         params(1,xmlObject->getElementQName().toString().c_str())
95                         );
96                 }
97             }
98         };
99
100         BEGIN_XMLOBJECTVALIDATOR(SAML_DLLLOCAL,Extensions);
101             if (!ptr->hasChildren())
102                 throw ValidationException("Extensions must have at least one child element.");
103             const vector<XMLObject*>& anys=ptr->getUnknownXMLObjects();
104             for_each(anys.begin(),anys.end(),checkWildcardNS());
105         END_XMLOBJECTVALIDATOR;
106
107         BEGIN_XMLOBJECTVALIDATOR(SAML_DLLLOCAL,Organization);
108             XMLOBJECTVALIDATOR_NONEMPTY(Organization,OrganizationName);
109             XMLOBJECTVALIDATOR_NONEMPTY(Organization,OrganizationDisplayName);
110             XMLOBJECTVALIDATOR_NONEMPTY(Organization,OrganizationURL);
111         END_XMLOBJECTVALIDATOR;
112
113         BEGIN_XMLOBJECTVALIDATOR(SAML_DLLLOCAL,ContactPerson);
114             /* Pending errata decision.
115             if (!ptr->hasChildren())
116                 throw ValidationException("ContactPerson must have at least one child element.");
117                 */
118             if (!XMLString::equals(ptr->getContactType(),ContactPerson::CONTACT_TECHNICAL) &&
119                 !XMLString::equals(ptr->getContactType(),ContactPerson::CONTACT_SUPPORT) &&
120                 !XMLString::equals(ptr->getContactType(),ContactPerson::CONTACT_ADMINISTRATIVE) &&
121                 !XMLString::equals(ptr->getContactType(),ContactPerson::CONTACT_BILLING) &&
122                 !XMLString::equals(ptr->getContactType(),ContactPerson::CONTACT_OTHER))
123                 throw ValidationException("ContactPerson contactType must be one of the defined values.");
124         END_XMLOBJECTVALIDATOR;
125
126         BEGIN_XMLOBJECTVALIDATOR(SAML_DLLLOCAL,AdditionalMetadataLocation);
127             XMLOBJECTVALIDATOR_REQUIRE(AdditionalMetadataLocation,Namespace);
128             XMLOBJECTVALIDATOR_REQUIRE(AdditionalMetadataLocation,Location);
129         END_XMLOBJECTVALIDATOR;
130
131         BEGIN_XMLOBJECTVALIDATOR(SAML_DLLLOCAL,KeyDescriptor);
132             XMLOBJECTVALIDATOR_REQUIRE(KeyDescriptor,KeyInfo);
133             if (ptr->getUse() &&
134                 !XMLString::equals(ptr->getUse(),KeyDescriptor::KEYTYPE_ENCRYPTION) &&
135                 !XMLString::equals(ptr->getUse(),KeyDescriptor::KEYTYPE_SIGNING))
136                 throw ValidationException("KeyDescriptor use must be empty or one of the defined values.");
137         END_XMLOBJECTVALIDATOR;
138
139         BEGIN_XMLOBJECTVALIDATOR(SAML_DLLLOCAL,RoleDescriptor);
140             XMLOBJECTVALIDATOR_REQUIRE(RoleDescriptor,ProtocolSupportEnumeration);
141         END_XMLOBJECTVALIDATOR;
142
143         BEGIN_XMLOBJECTVALIDATOR(SAML_DLLLOCAL,EndpointType);
144             XMLOBJECTVALIDATOR_REQUIRE(EndpointType,Binding);
145             XMLOBJECTVALIDATOR_REQUIRE(EndpointType,Location);
146             const vector<XMLObject*>& anys=ptr->getUnknownXMLObjects();
147             for_each(anys.begin(),anys.end(),checkWildcardNS());
148         END_XMLOBJECTVALIDATOR;
149
150         BEGIN_XMLOBJECTVALIDATOR_SUB(SAML_DLLLOCAL,IndexedEndpointType,EndpointType);
151             EndpointTypeSchemaValidator::validate(xmlObject);
152             XMLOBJECTVALIDATOR_REQUIRE_INTEGER(IndexedEndpointType,Index);
153         END_XMLOBJECTVALIDATOR;
154
155         BEGIN_XMLOBJECTVALIDATOR_SUB(SAML_DLLLOCAL,ArtifactResolutionService,IndexedEndpointType);
156             IndexedEndpointTypeSchemaValidator::validate(xmlObject);
157         END_XMLOBJECTVALIDATOR;
158
159         BEGIN_XMLOBJECTVALIDATOR_SUB(SAML_DLLLOCAL,SingleLogoutService,EndpointType);
160             EndpointTypeSchemaValidator::validate(xmlObject);
161         END_XMLOBJECTVALIDATOR;
162
163         BEGIN_XMLOBJECTVALIDATOR_SUB(SAML_DLLLOCAL,ManageNameIDService,EndpointType);
164             EndpointTypeSchemaValidator::validate(xmlObject);
165         END_XMLOBJECTVALIDATOR;
166
167         BEGIN_XMLOBJECTVALIDATOR_SUB(SAML_DLLLOCAL,SingleSignOnService,EndpointType);
168             EndpointTypeSchemaValidator::validate(xmlObject);
169         END_XMLOBJECTVALIDATOR;
170
171         BEGIN_XMLOBJECTVALIDATOR_SUB(SAML_DLLLOCAL,NameIDMappingService,EndpointType);
172             EndpointTypeSchemaValidator::validate(xmlObject);
173         END_XMLOBJECTVALIDATOR;
174
175         BEGIN_XMLOBJECTVALIDATOR_SUB(SAML_DLLLOCAL,AssertionIDRequestService,EndpointType);
176             EndpointTypeSchemaValidator::validate(xmlObject);
177         END_XMLOBJECTVALIDATOR;
178
179         BEGIN_XMLOBJECTVALIDATOR_SUB(SAML_DLLLOCAL,IDPSSODescriptor,RoleDescriptor);
180             RoleDescriptorSchemaValidator::validate(xmlObject);
181             XMLOBJECTVALIDATOR_NONEMPTY(IDPSSODescriptor,SingleSignOnService);
182         END_XMLOBJECTVALIDATOR;
183
184         BEGIN_XMLOBJECTVALIDATOR(SAML_DLLLOCAL,ServiceName);
185             XMLOBJECTVALIDATOR_REQUIRE(ServiceName,TextContent);
186             XMLOBJECTVALIDATOR_REQUIRE(ServiceName,Lang);
187         END_XMLOBJECTVALIDATOR;
188
189         BEGIN_XMLOBJECTVALIDATOR(SAML_DLLLOCAL,ServiceDescription);
190             XMLOBJECTVALIDATOR_REQUIRE(ServiceDescription,TextContent);
191             XMLOBJECTVALIDATOR_REQUIRE(ServiceDescription,Lang);
192         END_XMLOBJECTVALIDATOR;
193
194         BEGIN_XMLOBJECTVALIDATOR(SAML_DLLLOCAL,RequestedAttribute);
195             XMLOBJECTVALIDATOR_REQUIRE(RequestedAttribute,Name);
196         END_XMLOBJECTVALIDATOR;
197
198         BEGIN_XMLOBJECTVALIDATOR(SAML_DLLLOCAL,AttributeConsumingService);
199             XMLOBJECTVALIDATOR_REQUIRE_INTEGER(AttributeConsumingService,Index);
200             XMLOBJECTVALIDATOR_NONEMPTY(AttributeConsumingService,ServiceName);
201             XMLOBJECTVALIDATOR_NONEMPTY(AttributeConsumingService,RequestedAttribute);
202         END_XMLOBJECTVALIDATOR;
203
204         BEGIN_XMLOBJECTVALIDATOR_SUB(SAML_DLLLOCAL,AssertionConsumerService,IndexedEndpointType);
205             IndexedEndpointTypeSchemaValidator::validate(xmlObject);
206         END_XMLOBJECTVALIDATOR;
207
208         BEGIN_XMLOBJECTVALIDATOR_SUB(SAML_DLLLOCAL,SPSSODescriptor,RoleDescriptor);
209             RoleDescriptorSchemaValidator::validate(xmlObject);
210             XMLOBJECTVALIDATOR_NONEMPTY(SPSSODescriptor,AssertionConsumerService);
211         END_XMLOBJECTVALIDATOR;
212
213         BEGIN_XMLOBJECTVALIDATOR_SUB(SAML_DLLLOCAL,AuthnQueryService,EndpointType);
214             EndpointTypeSchemaValidator::validate(xmlObject);
215         END_XMLOBJECTVALIDATOR;
216
217         BEGIN_XMLOBJECTVALIDATOR_SUB(SAML_DLLLOCAL,AuthnAuthorityDescriptor,RoleDescriptor);
218             RoleDescriptorSchemaValidator::validate(xmlObject);
219             XMLOBJECTVALIDATOR_NONEMPTY(AuthnAuthorityDescriptor,AuthnQueryService);
220         END_XMLOBJECTVALIDATOR;
221
222         BEGIN_XMLOBJECTVALIDATOR_SUB(SAML_DLLLOCAL,AuthzService,EndpointType);
223             EndpointTypeSchemaValidator::validate(xmlObject);
224         END_XMLOBJECTVALIDATOR;
225
226         BEGIN_XMLOBJECTVALIDATOR_SUB(SAML_DLLLOCAL,PDPDescriptor,RoleDescriptor);
227             RoleDescriptorSchemaValidator::validate(xmlObject);
228             XMLOBJECTVALIDATOR_NONEMPTY(PDPDescriptor,AuthzService);
229         END_XMLOBJECTVALIDATOR;
230
231         BEGIN_XMLOBJECTVALIDATOR_SUB(SAML_DLLLOCAL,AttributeService,EndpointType);
232             EndpointTypeSchemaValidator::validate(xmlObject);
233         END_XMLOBJECTVALIDATOR;
234
235         BEGIN_XMLOBJECTVALIDATOR_SUB(SAML_DLLLOCAL,AttributeAuthorityDescriptor,RoleDescriptor);
236             RoleDescriptorSchemaValidator::validate(xmlObject);
237             XMLOBJECTVALIDATOR_NONEMPTY(AttributeAuthorityDescriptor,AttributeService);
238         END_XMLOBJECTVALIDATOR;
239
240         BEGIN_XMLOBJECTVALIDATOR(SAML_DLLLOCAL,AffiliationDescriptor);
241             XMLOBJECTVALIDATOR_REQUIRE(AffiliationDescriptor,AffiliationOwnerID);
242             XMLOBJECTVALIDATOR_NONEMPTY(AffiliationDescriptor,AffiliateMember);
243         END_XMLOBJECTVALIDATOR;
244
245         BEGIN_XMLOBJECTVALIDATOR(SAML_DLLLOCAL,EntityDescriptor);
246             XMLOBJECTVALIDATOR_REQUIRE(EntityDescriptor,EntityID);
247             if (ptr->getRoleDescriptors().empty() &&
248                 ptr->getIDPSSODescriptors().empty() &&
249                 ptr->getSPSSODescriptors().empty() &&
250                 ptr->getAuthnAuthorityDescriptors().empty() &&
251                 ptr->getAttributeAuthorityDescriptors().empty() &&
252                 ptr->getPDPDescriptors().empty()) {
253
254                 if (!ptr->getAffiliationDescriptor())
255                     throw ValidationException("EntityDescriptor must have at least one child role or affiliation descriptor.");
256             }
257             else if (ptr->getAffiliationDescriptor()) {
258                 throw ValidationException("EntityDescriptor cannot have both an AffiliationDescriptor and role descriptors.");
259             }
260         END_XMLOBJECTVALIDATOR;
261
262         BEGIN_XMLOBJECTVALIDATOR(SAML_DLLLOCAL,EntitiesDescriptor);
263             if (ptr->getEntityDescriptors().empty() && ptr->getEntitiesDescriptors().empty())
264                 throw ValidationException("EntitiesDescriptor must contain at least one child descriptor.");
265         END_XMLOBJECTVALIDATOR;
266
267         XMLOBJECTVALIDATOR_SIMPLE(SAML_DLLLOCAL,SourceID);
268
269         BEGIN_XMLOBJECTVALIDATOR_SUB(SAML_DLLLOCAL,DiscoveryResponse,IndexedEndpointType);
270             IndexedEndpointTypeSchemaValidator::validate(xmlObject);
271         END_XMLOBJECTVALIDATOR;
272
273         BEGIN_XMLOBJECTVALIDATOR_SUB(SAML_DLLLOCAL,RequestInitiator,EndpointType);
274             EndpointTypeSchemaValidator::validate(xmlObject);
275         END_XMLOBJECTVALIDATOR;
276
277         BEGIN_XMLOBJECTVALIDATOR(SAML_DLLLOCAL,EntityAttributes);
278             if (!ptr->hasChildren())
279                 throw ValidationException("EntityAttributes must contain at least one child element.");
280         END_XMLOBJECTVALIDATOR;
281
282         BEGIN_XMLOBJECTVALIDATOR(SAML_DLLLOCAL,DigestMethod);
283             XMLOBJECTVALIDATOR_REQUIRE(DigestMethod,Algorithm);
284         END_XMLOBJECTVALIDATOR;
285
286         BEGIN_XMLOBJECTVALIDATOR(SAML_DLLLOCAL,SigningMethod);
287             XMLOBJECTVALIDATOR_REQUIRE(SigningMethod,Algorithm);
288         END_XMLOBJECTVALIDATOR;
289
290         BEGIN_XMLOBJECTVALIDATOR(SAML_DLLLOCAL,DisplayName);
291             XMLOBJECTVALIDATOR_REQUIRE(DisplayName,TextContent);
292             XMLOBJECTVALIDATOR_REQUIRE(DisplayName,Lang);
293         END_XMLOBJECTVALIDATOR;
294
295         BEGIN_XMLOBJECTVALIDATOR(SAML_DLLLOCAL,Description);
296             XMLOBJECTVALIDATOR_REQUIRE(Description,TextContent);
297             XMLOBJECTVALIDATOR_REQUIRE(Description,Lang);
298         END_XMLOBJECTVALIDATOR;
299
300         BEGIN_XMLOBJECTVALIDATOR(SAML_DLLLOCAL,Keywords);
301             XMLOBJECTVALIDATOR_REQUIRE(Keywords,TextContent);
302             XMLOBJECTVALIDATOR_REQUIRE(Keywords,Lang);
303         END_XMLOBJECTVALIDATOR;
304
305         BEGIN_XMLOBJECTVALIDATOR(SAML_DLLLOCAL,Logo);
306             XMLOBJECTVALIDATOR_REQUIRE(Logo,TextContent);
307             XMLOBJECTVALIDATOR_REQUIRE_INTEGER(Logo,Height);
308             XMLOBJECTVALIDATOR_REQUIRE_INTEGER(Logo,Width);
309         END_XMLOBJECTVALIDATOR;
310
311         BEGIN_XMLOBJECTVALIDATOR(SAML_DLLLOCAL,InformationURL);
312             XMLOBJECTVALIDATOR_REQUIRE(InformationURL,TextContent);
313             XMLOBJECTVALIDATOR_REQUIRE(InformationURL,Lang);
314         END_XMLOBJECTVALIDATOR;
315
316         BEGIN_XMLOBJECTVALIDATOR(SAML_DLLLOCAL,PrivacyStatementURL);
317             XMLOBJECTVALIDATOR_REQUIRE(PrivacyStatementURL,TextContent);
318             XMLOBJECTVALIDATOR_REQUIRE(PrivacyStatementURL,Lang);
319         END_XMLOBJECTVALIDATOR;
320
321         XMLOBJECTVALIDATOR_SIMPLE(SAML_DLLLOCAL,IPHint);
322         XMLOBJECTVALIDATOR_SIMPLE(SAML_DLLLOCAL,DomainHint);
323         XMLOBJECTVALIDATOR_SIMPLE(SAML_DLLLOCAL,GeolocationHint);
324     };
325 };
326
327 #define REGISTER_ELEMENT(cname) \
328     q=xmltooling::QName(SAML20MD_NS,cname::LOCAL_NAME); \
329     XMLObjectBuilder::registerBuilder(q,new cname##Builder()); \
330     SchemaValidators.registerValidator(q,new cname##SchemaValidator())
331
332 #define REGISTER_TYPE(cname) \
333     q=xmltooling::QName(SAML20MD_NS,cname::TYPE_NAME); \
334     XMLObjectBuilder::registerBuilder(q,new cname##Builder()); \
335     SchemaValidators.registerValidator(q,new cname##SchemaValidator())
336
337 #define REGISTER_ELEMENT_UI(cname) \
338     q=xmltooling::QName(SAML20MD_UI_NS,cname::LOCAL_NAME); \
339     XMLObjectBuilder::registerBuilder(q,new cname##Builder()); \
340     SchemaValidators.registerValidator(q,new cname##SchemaValidator())
341
342 #define REGISTER_TYPE_UI(cname) \
343     q=xmltooling::QName(SAML20MD_UI_NS,cname::TYPE_NAME); \
344     XMLObjectBuilder::registerBuilder(q,new cname##Builder()); \
345     SchemaValidators.registerValidator(q,new cname##SchemaValidator())
346
347 #define REGISTER_ELEMENT_UI_NOVAL(cname) \
348     q=xmltooling::QName(SAML20MD_UI_NS,cname::LOCAL_NAME); \
349     XMLObjectBuilder::registerBuilder(q,new cname##Builder());
350
351 #define REGISTER_TYPE_UI_NOVAL(cname) \
352     q=xmltooling::QName(SAML20MD_UI_NS,cname::TYPE_NAME); \
353     XMLObjectBuilder::registerBuilder(q,new cname##Builder());
354
355 void opensaml::saml2md::registerMetadataClasses() {
356     xmltooling::QName q;
357     REGISTER_ELEMENT(AdditionalMetadataLocation);
358     REGISTER_ELEMENT(AffiliateMember);
359     REGISTER_ELEMENT(AffiliationDescriptor);
360     REGISTER_ELEMENT(ArtifactResolutionService);
361     REGISTER_ELEMENT(AssertionConsumerService);
362     REGISTER_ELEMENT(AssertionIDRequestService);
363     REGISTER_ELEMENT(AttributeAuthorityDescriptor);;
364     REGISTER_ELEMENT(AttributeConsumingService);
365     REGISTER_ELEMENT(AttributeProfile);
366     REGISTER_ELEMENT(AttributeService);
367     REGISTER_ELEMENT(AuthnAuthorityDescriptor);
368     REGISTER_ELEMENT(AuthnQueryService);
369     REGISTER_ELEMENT(AuthzService);
370     REGISTER_ELEMENT(Company);
371     REGISTER_ELEMENT(ContactPerson);
372     REGISTER_ELEMENT(EmailAddress);
373     REGISTER_ELEMENT(EntitiesDescriptor);
374     REGISTER_ELEMENT(EntityDescriptor);
375     REGISTER_ELEMENT(Extensions);
376     REGISTER_ELEMENT(GivenName);
377     REGISTER_ELEMENT(IDPSSODescriptor);
378     REGISTER_ELEMENT(KeyDescriptor);
379     REGISTER_ELEMENT(ManageNameIDService);
380     REGISTER_ELEMENT(NameIDFormat);
381     REGISTER_ELEMENT(NameIDMappingService);
382     REGISTER_ELEMENT(Organization);
383     REGISTER_ELEMENT(OrganizationDisplayName);
384     REGISTER_ELEMENT(OrganizationName);
385     REGISTER_ELEMENT(OrganizationURL);
386     REGISTER_ELEMENT(PDPDescriptor);
387     REGISTER_ELEMENT(RequestedAttribute);
388     REGISTER_ELEMENT(RoleDescriptor);
389     REGISTER_ELEMENT(ServiceDescription);
390     REGISTER_ELEMENT(ServiceName);
391     REGISTER_ELEMENT(SingleLogoutService);
392     REGISTER_ELEMENT(SingleSignOnService);
393     REGISTER_ELEMENT(SPSSODescriptor);
394     REGISTER_ELEMENT(SurName);
395     REGISTER_ELEMENT(TelephoneNumber);
396     REGISTER_TYPE(AdditionalMetadataLocation);
397     REGISTER_TYPE(AffiliationDescriptor);
398     REGISTER_TYPE(AttributeAuthorityDescriptor);;
399     REGISTER_TYPE(AttributeConsumingService);
400     REGISTER_TYPE(AuthnAuthorityDescriptor);
401     REGISTER_TYPE(ContactPerson);
402     REGISTER_TYPE(EndpointType);
403     REGISTER_TYPE(EntitiesDescriptor);
404     REGISTER_TYPE(EntityDescriptor);
405     REGISTER_TYPE(Extensions);
406     REGISTER_TYPE(IDPSSODescriptor);
407     REGISTER_TYPE(IndexedEndpointType);
408     REGISTER_TYPE(KeyDescriptor);
409     REGISTER_TYPE(localizedNameType);
410     REGISTER_TYPE(localizedURIType);
411     REGISTER_TYPE(Organization);
412     REGISTER_TYPE(PDPDescriptor);
413     REGISTER_TYPE(RequestedAttribute);
414     REGISTER_TYPE(SPSSODescriptor);
415
416     q=xmltooling::QName(SAML20MD_NS,xmlencryption::EncryptionMethod::LOCAL_NAME);
417     XMLObjectBuilder::registerBuilder(q,new xmlencryption::EncryptionMethodBuilder());
418
419     q=xmltooling::QName(SAML1MD_NS,SourceID::LOCAL_NAME);
420     XMLObjectBuilder::registerBuilder(q,new SourceIDBuilder());
421     SchemaValidators.registerValidator(q,new SourceIDSchemaValidator());
422
423     q=xmltooling::QName(IDP_DISCOVERY_PROTOCOL_NS,DiscoveryResponse::LOCAL_NAME);
424     XMLObjectBuilder::registerBuilder(q,new DiscoveryResponseBuilder());
425     SchemaValidators.registerValidator(q,new DiscoveryResponseSchemaValidator());
426
427     q=xmltooling::QName(SP_REQUEST_INIT_NS,RequestInitiator::LOCAL_NAME);
428     XMLObjectBuilder::registerBuilder(q,new RequestInitiatorBuilder());
429     SchemaValidators.registerValidator(q,new RequestInitiatorSchemaValidator());
430
431     q=xmltooling::QName(SAML20MD_QUERY_EXT_NS,ActionNamespace::LOCAL_NAME);
432     XMLObjectBuilder::registerBuilder(q,new ActionNamespaceBuilder());
433     SchemaValidators.registerValidator(q,new ActionNamespaceSchemaValidator());
434
435     q=xmltooling::QName(SAML20MD_QUERY_EXT_NS,AuthnQueryDescriptorType::TYPE_NAME);
436     XMLObjectBuilder::registerBuilder(q,new AuthnQueryDescriptorTypeBuilder());
437     SchemaValidators.registerValidator(q,new RoleDescriptorSchemaValidator());
438
439     q=xmltooling::QName(SAML20MD_QUERY_EXT_NS,AttributeQueryDescriptorType::TYPE_NAME);
440     XMLObjectBuilder::registerBuilder(q,new AttributeQueryDescriptorTypeBuilder());
441     SchemaValidators.registerValidator(q,new RoleDescriptorSchemaValidator());
442
443     q=xmltooling::QName(SAML20MD_QUERY_EXT_NS,AuthzDecisionQueryDescriptorType::TYPE_NAME);
444     XMLObjectBuilder::registerBuilder(q,new AuthzDecisionQueryDescriptorTypeBuilder());
445     SchemaValidators.registerValidator(q,new RoleDescriptorSchemaValidator());
446
447     q=xmltooling::QName(SAML20MD_ENTITY_ATTRIBUTE_NS,EntityAttributes::LOCAL_NAME);
448     XMLObjectBuilder::registerBuilder(q,new EntityAttributesBuilder());
449     SchemaValidators.registerValidator(q,new EntityAttributesSchemaValidator());
450
451     q=xmltooling::QName(SAML20MD_ENTITY_ATTRIBUTE_NS,EntityAttributes::TYPE_NAME);
452     XMLObjectBuilder::registerBuilder(q,new EntityAttributesBuilder());
453     SchemaValidators.registerValidator(q,new EntityAttributesSchemaValidator());
454
455     q=xmltooling::QName(SAML20MD_ALGSUPPORT_NS,DigestMethod::LOCAL_NAME);
456     XMLObjectBuilder::registerBuilder(q,new DigestMethodBuilder());
457     SchemaValidators.registerValidator(q,new DigestMethodSchemaValidator());
458
459     q=xmltooling::QName(SAML20MD_ALGSUPPORT_NS,DigestMethod::TYPE_NAME);
460     XMLObjectBuilder::registerBuilder(q,new DigestMethodBuilder());
461     SchemaValidators.registerValidator(q,new DigestMethodSchemaValidator());
462
463     q=xmltooling::QName(SAML20MD_ALGSUPPORT_NS,SigningMethod::LOCAL_NAME);
464     XMLObjectBuilder::registerBuilder(q,new SigningMethodBuilder());
465     SchemaValidators.registerValidator(q,new SigningMethodSchemaValidator());
466
467     q=xmltooling::QName(SAML20MD_ALGSUPPORT_NS,SigningMethod::TYPE_NAME);
468     XMLObjectBuilder::registerBuilder(q,new SigningMethodBuilder());
469     SchemaValidators.registerValidator(q,new SigningMethodSchemaValidator());
470
471     REGISTER_ELEMENT_UI(DisplayName);
472     REGISTER_ELEMENT_UI(Description);
473         REGISTER_ELEMENT_UI(Keywords);
474     REGISTER_ELEMENT_UI(Logo);
475     REGISTER_ELEMENT_UI(InformationURL);
476     REGISTER_ELEMENT_UI(PrivacyStatementURL);
477     REGISTER_ELEMENT_UI(IPHint);
478     REGISTER_ELEMENT_UI(DomainHint);
479     REGISTER_ELEMENT_UI(GeolocationHint);
480         REGISTER_TYPE_UI(Keywords);
481     REGISTER_TYPE_UI(Logo);
482     REGISTER_ELEMENT_UI_NOVAL(UIInfo);
483     REGISTER_ELEMENT_UI_NOVAL(DiscoHints);
484     REGISTER_TYPE_UI_NOVAL(UIInfo);
485     REGISTER_TYPE_UI_NOVAL(DiscoHints);
486 }