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/AttributeDecoder.h
24 * Decodes SAML NameID/Attribute objects into resolved Attributes.
27 #ifndef __shibsp_attrdecoder_h__
28 #define __shibsp_attrdecoder_h__
30 #include <shibsp/base.h>
35 namespace xmltooling {
36 class XMLTOOL_API QName;
37 class XMLTOOL_API XMLObject;
42 class SHIBSP_API Attribute;
45 * Decodes XML objects into resolved Attributes.
47 class SHIBSP_API AttributeDecoder
49 MAKE_NONCOPYABLE(AttributeDecoder);
54 * @param e root of DOM to configure the decoder
56 AttributeDecoder(const xercesc::DOMElement* e);
58 /** Flag for case sensitivity of decoded attributes. */
61 /** Flag for hiding attributes from CGI export. */
64 /** Hash algorithm to apply to decoded values. */
65 std::string m_hashAlg;
68 * Helper method to handle base class decoding housekeeping.
70 * @param attr the new Attribute object being created
71 * @return the attr parameter
73 virtual Attribute* _decode(Attribute* attr) const;
76 virtual ~AttributeDecoder();
79 * Decodes an XMLObject into a resolved Attribute.
81 * @param ids array containing primary identifier in first position, followed by any aliases
82 * @param xmlObject XMLObject to decode
83 * @param assertingParty name of the party asserting the attribute
84 * @param relyingParty name of the party relying on the attribute
85 * @return a resolved Attribute, or nullptr
87 virtual Attribute* decode(
88 const std::vector<std::string>& ids,
89 const xmltooling::XMLObject* xmlObject,
90 const char* assertingParty=nullptr,
91 const char* relyingParty=nullptr
96 /** Decodes into a SimpleAttribute. */
97 extern SHIBSP_API xmltooling::QName StringAttributeDecoderType;
99 /** Decodes scoped and NameID attributes into a ScopedAttribute. */
100 extern SHIBSP_API xmltooling::QName ScopedAttributeDecoderType;
102 /** Decodes NameID information into a NameIDAttribute. */
103 extern SHIBSP_API xmltooling::QName NameIDAttributeDecoderType;
105 /** Decodes scoped attributes into a NameIDAttribute. */
106 extern SHIBSP_API xmltooling::QName NameIDFromScopedAttributeDecoderType;
108 /** Decodes KeyInfo information into a SimpleAttribute. */
109 extern SHIBSP_API xmltooling::QName KeyInfoAttributeDecoderType;
111 /** Decodes arbitrary DOM information into an ExtensibleAttribute. */
112 extern SHIBSP_API xmltooling::QName DOMAttributeDecoderType;
114 /** Decodes arbitrary XML into an XMLAttribute. */
115 extern SHIBSP_API xmltooling::QName XMLAttributeDecoderType;
117 /** Decodes base64-encoded data into a SimpleAttribute. */
118 extern SHIBSP_API xmltooling::QName Base64AttributeDecoderType;
120 /** Registers built-in AttributeDecoders into the runtime. */
121 void registerAttributeDecoders();
124 #endif /* __shibsp_attrdecoder_h__ */