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();
65 * Extracts the attributes found in an XMLObject.
67 * @param application Application performing the extraction
68 * @param issuer source of object, if known
69 * @param xmlObject object to extract
70 * @param attributes an array to populate with the extracted attributes
72 * @throws AttributeExtractionException thrown if there is a problem extracting attributes
74 virtual void extractAttributes(
75 const Application& application,
76 const opensaml::saml2md::RoleDescriptor* issuer,
77 const xmltooling::XMLObject& xmlObject,
78 std::vector<Attribute*>& attributes
82 * Extracts the attributes found in an XMLObject.
84 * @param application Application performing the extraction
85 * @param request request triggering the extraction, if any
86 * @param issuer source of object, if known
87 * @param xmlObject object to extract
88 * @param attributes an array to populate with the extracted attributes
90 * @throws AttributeExtractionException thrown if there is a problem extracting attributes
92 virtual void extractAttributes(
93 const Application& application,
94 const xmltooling::GenericRequest* request,
95 const opensaml::saml2md::RoleDescriptor* issuer,
96 const xmltooling::XMLObject& xmlObject,
97 std::vector<Attribute*>& attributes
101 * Populates an array with the set of Attribute IDs that might be generated.
103 * @param attributes array to populate
105 virtual void getAttributeIds(std::vector<std::string>& attributes) const=0;
108 * Generates and/or modifies metadata reflecting the extractor,
109 * typically attribute-related requirements.
111 * <p>The default implementation does nothing.
113 * @param role metadata role to decorate
115 virtual void generateMetadata(opensaml::saml2md::SPSSODescriptor& role) const;
119 * Registers AttributeExtractor classes into the runtime.
121 void SHIBSP_API registerAttributeExtractors();
123 /** AttributeExtractor based on an XML mapping schema. */
124 #define XML_ATTRIBUTE_EXTRACTOR "XML"
126 /** AttributeExtractor for SAML assertion information. */
127 #define ASSERTION_ATTRIBUTE_EXTRACTOR "Assertion"
129 /** AttributeExtractor for SAML metadata information. */
130 #define METADATA_ATTRIBUTE_EXTRACTOR "Metadata"
132 /** AttributeExtractor for DelegationRestriction information. */
133 #define DELEGATION_ATTRIBUTE_EXTRACTOR "Delegation"
135 /** AttributeExtractor for KeyInfo information. */
136 #define KEYDESCRIPTOR_ATTRIBUTE_EXTRACTOR "KeyDescriptor"
138 /** AttributeExtractor based on chaining together other extractors. */
139 #define CHAINING_ATTRIBUTE_EXTRACTOR "Chaining"
142 #endif /* __shibsp_extractor_h__ */