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 shibsp/attribute/resolver/AttributeExtractor.h
20 * A service that extracts and decodes attributes from XML objects.
23 #ifndef __shibsp_extractor_h__
24 #define __shibsp_extractor_h__
26 #include <shibsp/base.h>
30 #include <xmltooling/Lockable.h>
32 namespace xmltooling {
33 class XMLTOOL_API XMLObject;
38 class SAML_API RoleDescriptor;
44 class SHIBSP_API Application;
45 class SHIBSP_API Attribute;
48 * A service that extracts and decodes attributes from XML objects.
50 class SHIBSP_API AttributeExtractor : public virtual xmltooling::Lockable
52 MAKE_NONCOPYABLE(AttributeExtractor);
56 virtual ~AttributeExtractor();
59 * Extracts the attributes found in an XMLObject.
61 * @param application Application performing the extraction
62 * @param issuer source of object, if known
63 * @param xmlObject object to extract
64 * @param attributes an array to populate with the extracted attributes
66 * @throws AttributeExtractionException thrown if there is a problem extracting attributes
68 virtual void extractAttributes(
69 const Application& application,
70 const opensaml::saml2md::RoleDescriptor* issuer,
71 const xmltooling::XMLObject& xmlObject,
72 std::vector<Attribute*>& attributes
76 * Populates an array with the set of Attribute IDs that might be generated.
78 * @param attributes array to populate
80 virtual void getAttributeIds(std::vector<std::string>& attributes) const=0;
84 * Registers AttributeExtractor classes into the runtime.
86 void SHIBSP_API registerAttributeExtractors();
88 /** AttributeExtractor based on an XML mapping schema. */
89 #define XML_ATTRIBUTE_EXTRACTOR "XML"
91 /** AttributeExtractor for DelegationRestriction information. */
92 #define DELEGATION_ATTRIBUTE_EXTRACTOR "Delegation"
94 /** AttributeExtractor for KeyInfo information. */
95 #define KEYDESCRIPTOR_ATTRIBUTE_EXTRACTOR "KeyDescriptor"
97 /** AttributeExtractor based on chaining together other extractors. */
98 #define CHAINING_ATTRIBUTE_EXTRACTOR "Chaining"
101 #endif /* __shibsp_extractor_h__ */