Imported Upstream version 2.4+dfsg
[shibboleth/sp.git] / shibsp / attribute / AttributeDecoder.h
index 5b0ad48..03b7485 100644 (file)
@@ -1,5 +1,5 @@
 /*
- *  Copyright 2001-2009 Internet2
+ *  Copyright 2001-2010 Internet2
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with 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.
      */
@@ -48,20 +57,19 @@ namespace shibsp {
         /** 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 {
-            attr->setCaseSensitive(m_caseSensitive);
-            attr->setInternal(m_internal);
-            return attr;
-        }
+        virtual Attribute* _decode(Attribute* attr) const;
 
     public:
-        virtual ~AttributeDecoder() {}
+        virtual ~AttributeDecoder();
 
         /**
          * Decodes an XMLObject into a resolved Attribute.
@@ -70,13 +78,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;
     };
 
@@ -102,6 +110,9 @@ namespace shibsp {
     /** 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();
 };