Back to index

nordugrid-arc-nox  1.1.0~rc6
XACMLAttributeProxy.h
Go to the documentation of this file.
00001 #ifndef __ARC_SEC_XACMLATTRIBUTEPROXY_H__
00002 #define __ARC_SEC_XACMLATTRIBUTEPROXY_H__
00003 
00004 #include <list>
00005 #include <fstream>
00006 #include <arc/XMLNode.h>
00007 #include <arc/Logger.h>
00008 #include <arc/security/ArcPDP/attr/AttributeValue.h>
00009 #include <arc/security/ArcPDP/attr/AttributeProxy.h>
00010 
00011 namespace ArcSec {
00013 template <class TheAttribute>
00014 class XACMLAttributeProxy : public AttributeProxy {
00015 public:
00016   XACMLAttributeProxy(){};
00017   virtual ~XACMLAttributeProxy(){};
00018 public: 
00019   virtual AttributeValue* getAttribute(const Arc::XMLNode& node);
00020 };
00021 
00023 template <class TheAttribute>
00024 AttributeValue* XACMLAttributeProxy<TheAttribute>::getAttribute(const Arc::XMLNode& node){
00025   Arc::XMLNode x;
00026   std::string value;
00027   if((bool)(const_cast<Arc::XMLNode&>(node).Child())) {
00028     x=const_cast<Arc::XMLNode&>(node).Child(0); 
00029   } else {
00030     x=node;
00031   }
00032   value = (std::string)x;
00033   std::string attrid =
00034         (std::string)(const_cast<Arc::XMLNode&>(node).Attribute("AttributeId"));
00035   std::size_t start;
00036   start = value.find_first_not_of(" \n\r\t");
00037   value = value.substr(start);
00038   std::size_t end;
00039   end = value.find_last_not_of(" \n\r\t");
00040   value = value.substr(0, end+1);
00041   return new TheAttribute(value, attrid);
00042 }
00043 
00044 } // namespace ArcSec
00045 
00046 #endif /* __ARC_SEC_XACMLATTRIBUTEPROXY_H__ */
00047