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 * @file saml/saml2/metadata/MetadataFilter.h
24 * Processes metadata after it's been unmarshalled.
27 #include <saml/saml2/metadata/MetadataProvider.h>
29 #ifndef __saml2_metadatafilt_h__
30 #define __saml2_metadatafilt_h__
36 * A metadata filter is used to process metadata after resolution and unmarshalling.
38 * Some filters might remove everything but identity provider roles, decreasing the data a service provider
39 * needs to work with, or a filter could be used to perform integrity checking on the retrieved metadata by
40 * verifying a digital signature.
42 class SAML_API MetadataFilter
44 MAKE_NONCOPYABLE(MetadataFilter);
48 virtual ~MetadataFilter();
51 * Returns an identifying string for the filter.
53 * @return the ID string
55 virtual const char* getId() const=0;
58 * Filters the given metadata. Exceptions should generally not be thrown to
59 * signal the removal of information, only for systemic processing failure.
61 * @param xmlObject the metadata to be filtered.
63 virtual void doFilter(xmltooling::XMLObject& xmlObject) const=0;
67 * Registers MetadataFilter classes into the runtime.
69 void SAML_API registerMetadataFilters();
71 /** MetadataFilter that deletes blacklisted entities. */
72 #define BLACKLIST_METADATA_FILTER "Blacklist"
74 /** MetadataFilter that deletes all but whitelisted entities. */
75 #define WHITELIST_METADATA_FILTER "Whitelist"
77 /** MetadataFilter that verifies signatures and filters out any that don't pass. */
78 #define SIGNATURE_METADATA_FILTER "Signature"
80 /** MetadataFilter that enforces expiration requirements. */
81 #define REQUIREVALIDUNTIL_METADATA_FILTER "RequireValidUntil"
83 /** MetadataFilter that removes non-retained roles. */
84 #define ENTITYROLE_METADATA_FILTER "EntityRoleWhiteList"
86 DECL_XMLTOOLING_EXCEPTION(MetadataFilterException,SAML_EXCEPTIONAPI(SAML_API),opensaml::saml2md,MetadataException,Exceptions related to metadata filtering);
90 #endif /* __saml2_metadatafilt_h__ */