+SunRequestMapper::SunRequestMapper(const DOMElement* e) : m_mapper(NULL), m_stKey(NULL), m_propsKey(NULL)
+{
+ IPlugIn* p=SAMLConfig::getConfig().getPlugMgr().newPlugin(shibtarget::XML::XMLRequestMapType,e);
+ m_mapper=dynamic_cast<IRequestMapper*>(p);
+ if (!m_mapper) {
+ delete p;
+ throw UnsupportedExtensionException("Embedded request mapper plugin was not of correct type.");
+ }
+ m_stKey=ThreadKey::create(NULL);
+ m_propsKey=ThreadKey::create(NULL);
+}
+
+IRequestMapper::Settings SunRequestMapper::getSettings(ShibTarget* st) const
+{
+ Settings s=m_mapper->getSettings(st);
+ m_stKey->setData(dynamic_cast<ShibTargetNSAPI*>(st));
+ m_propsKey->setData((void*)s.first);
+ return pair<const IPropertySet*,IAccessControl*>(this,s.second);
+}
+
+pair<bool,bool> SunRequestMapper::getBool(const char* name, const char* ns) const
+{
+ ShibTargetNSAPI* stn=reinterpret_cast<ShibTargetNSAPI*>(m_stKey->getData());
+ const IPropertySet* s=reinterpret_cast<const IPropertySet*>(m_propsKey->getData());
+ if (stn && !ns && name) {
+ // Override boolean properties.
+ const char* param=pblock_findval(name,stn->m_pb);
+ if (param && (!strcmp(param,"1") || !util_strcasecmp(param,"true")))
+ return make_pair(true,true);
+ }
+ return s ? s->getBool(name,ns) : make_pair(false,false);
+}
+
+pair<bool,const char*> SunRequestMapper::getString(const char* name, const char* ns) const
+{
+ ShibTargetNSAPI* stn=reinterpret_cast<ShibTargetNSAPI*>(m_stKey->getData());
+ const IPropertySet* s=reinterpret_cast<const IPropertySet*>(m_propsKey->getData());
+ if (stn && !ns && name) {
+ // Override string properties.
+ if (!strcmp(name,"authType"))
+ return pair<bool,const char*>(true,"shibboleth");
+ else {
+ const char* param=pblock_findval(name,stn->m_pb);
+ if (param)
+ return make_pair(true,param);
+ }
+ }
+ return s ? s->getString(name,ns) : pair<bool,const char*>(false,NULL);
+}
+
+pair<bool,const XMLCh*> SunRequestMapper::getXMLString(const char* name, const char* ns) const
+{
+ const IPropertySet* s=reinterpret_cast<const IPropertySet*>(m_propsKey->getData());
+ return s ? s->getXMLString(name,ns) : pair<bool,const XMLCh*>(false,NULL);
+}
+
+pair<bool,unsigned int> SunRequestMapper::getUnsignedInt(const char* name, const char* ns) const
+{
+ const IPropertySet* s=reinterpret_cast<const IPropertySet*>(m_propsKey->getData());
+ return s ? s->getUnsignedInt(name,ns) : make_pair(false,0);
+}
+
+pair<bool,int> SunRequestMapper::getInt(const char* name, const char* ns) const
+{
+ const IPropertySet* s=reinterpret_cast<const IPropertySet*>(m_propsKey->getData());
+ return s ? s->getInt(name,ns) : make_pair(false,0);
+}
+
+const IPropertySet* SunRequestMapper::getPropertySet(const char* name, const char* ns) const
+{
+ const IPropertySet* s=reinterpret_cast<const IPropertySet*>(m_propsKey->getData());
+ return s ? s->getPropertySet(name,ns) : NULL;
+}
+
+const DOMElement* SunRequestMapper::getElement() const
+{
+ const IPropertySet* s=reinterpret_cast<const IPropertySet*>(m_propsKey->getData());
+ return s ? s->getElement() : NULL;
+}
+
+
+#if 0