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