Change license header.
[shibboleth/cpp-sp.git] / shibsp / attribute / AttributeDecoder.h
index e0ad576..4315316 100644 (file)
@@ -1,17 +1,21 @@
-/*
- *  Copyright 2001-2009 Internet2
+/**
+ * Licensed to the University Corporation for Advanced Internet
+ * Development, Inc. (UCAID) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for
+ * additional information regarding copyright ownership.
  *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * UCAID licenses this file to you under the Apache License,
+ * Version 2.0 (the "License"); you may not use this file except
+ * in compliance with the License. You may obtain a copy of the
+ * License at
  *
- *     http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
  *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
+ * either express or implied. See the License for the specific
+ * language governing permissions and limitations under the License.
  */
 
 /**
 #ifndef __shibsp_attrdecoder_h__
 #define __shibsp_attrdecoder_h__
 
-#include <shibsp/attribute/Attribute.h>
-#include <xmltooling/XMLObject.h>
+#include <shibsp/base.h>
+
+#include <string>
+#include <vector>
+
+namespace xmltooling {
+    class XMLTOOL_API QName;
+    class XMLTOOL_API XMLObject;
+};
 
 namespace shibsp {
 
+    class SHIBSP_API Attribute;
+
     /**
      * Decodes XML objects into resolved Attributes.
      */
@@ -45,8 +58,22 @@ namespace shibsp {
         /** Flag for case sensitivity of decoded attributes. */
         bool m_caseSensitive;
 
+        /** Flag for hiding attributes from CGI export. */
+        bool m_internal;
+
+        /** Hash algorithm to apply to decoded values. */
+        std::string m_hashAlg;
+
+        /**
+         * Helper method to handle base class decoding housekeeping.
+         *
+         * @param attr  the new Attribute object being created
+         * @return  the attr parameter
+         */
+        virtual Attribute* _decode(Attribute* attr) const;
+
     public:
-        virtual ~AttributeDecoder() {}
+        virtual ~AttributeDecoder();
 
         /**
          * Decodes an XMLObject into a resolved Attribute.
@@ -55,13 +82,13 @@ namespace shibsp {
          * @param xmlObject         XMLObject to decode
          * @param assertingParty    name of the party asserting the attribute
          * @param relyingParty      name of the party relying on the attribute
-         * @return a resolved Attribute, or NULL
+         * @return a resolved Attribute, or nullptr
          */
         virtual Attribute* decode(
             const std::vector<std::string>& ids,
             const xmltooling::XMLObject* xmlObject,
-            const char* assertingParty=NULL,
-            const char* relyingParty=NULL
+            const char* assertingParty=nullptr,
+            const char* relyingParty=nullptr
             ) const=0;
     };
 
@@ -84,6 +111,12 @@ namespace shibsp {
     /** Decodes arbitrary DOM information into an ExtensibleAttribute. */
     extern SHIBSP_API xmltooling::QName DOMAttributeDecoderType;
 
+    /** Decodes arbitrary XML into an XMLAttribute. */
+    extern SHIBSP_API xmltooling::QName XMLAttributeDecoderType;
+
+    /** Decodes base64-encoded data into a SimpleAttribute. */
+    extern SHIBSP_API xmltooling::QName Base64AttributeDecoderType;
+
     /** Registers built-in AttributeDecoders into the runtime. */
     void registerAttributeDecoders();
 };