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 shibsp/attribute/resolver/AttributeExtractor.h
24 * A service that extracts and decodes attributes from XML objects.
27 #ifndef __shibsp_extractor_h__
28 #define __shibsp_extractor_h__
30 #include <shibsp/base.h>
34 #include <xmltooling/Lockable.h>
36 namespace xmltooling {
37 class XMLTOOL_API XMLObject;
42 class SAML_API RoleDescriptor;
43 class SAML_API SPSSODescriptor;
49 class SHIBSP_API Application;
50 class SHIBSP_API Attribute;
53 * A service that extracts and decodes attributes from XML objects.
55 class SHIBSP_API AttributeExtractor : public virtual xmltooling::Lockable
57 MAKE_NONCOPYABLE(AttributeExtractor);
61 virtual ~AttributeExtractor();
64 * Extracts the attributes found in an XMLObject.
66 * @param application Application performing the extraction
67 * @param issuer source of object, if known
68 * @param xmlObject object to extract
69 * @param attributes an array to populate with the extracted attributes
71 * @throws AttributeExtractionException thrown if there is a problem extracting attributes
73 virtual void extractAttributes(
74 const Application& application,
75 const opensaml::saml2md::RoleDescriptor* issuer,
76 const xmltooling::XMLObject& xmlObject,
77 std::vector<Attribute*>& attributes
81 * Populates an array with the set of Attribute IDs that might be generated.
83 * @param attributes array to populate
85 virtual void getAttributeIds(std::vector<std::string>& attributes) const=0;
88 * Generates and/or modifies metadata reflecting the extractor,
89 * typically attribute-related requirements.
91 * <p>The default implementation does nothing.
93 * @param role metadata role to decorate
95 virtual void generateMetadata(opensaml::saml2md::SPSSODescriptor& role) const;
99 * Registers AttributeExtractor classes into the runtime.
101 void SHIBSP_API registerAttributeExtractors();
103 /** AttributeExtractor based on an XML mapping schema. */
104 #define XML_ATTRIBUTE_EXTRACTOR "XML"
106 /** AttributeExtractor for DelegationRestriction information. */
107 #define DELEGATION_ATTRIBUTE_EXTRACTOR "Delegation"
109 /** AttributeExtractor for KeyInfo information. */
110 #define KEYDESCRIPTOR_ATTRIBUTE_EXTRACTOR "KeyDescriptor"
112 /** AttributeExtractor based on chaining together other extractors. */
113 #define CHAINING_ATTRIBUTE_EXTRACTOR "Chaining"
116 #endif /* __shibsp_extractor_h__ */