- // Process assertion export handler.
- pair<bool,const char*> location = sessions ? sessions->getString("exportLocation") : pair<bool,const char*>(false,NULL);
- if (location.first) {
- try {
- DOMElement* exportElement = e->getOwnerDocument()->createElementNS(shibspconstants::SHIB2SPCONFIG_NS,_Handler);
- exportElement->setAttributeNS(NULL,Location,sessions->getXMLString("exportLocation").second);
- pair<bool,const XMLCh*> exportACL = sessions->getXMLString("exportACL");
- if (exportACL.first) {
- static const XMLCh _acl[] = UNICODE_LITERAL_9(e,x,p,o,r,t,A,C,L);
- exportElement->setAttributeNS(NULL,_acl,exportACL.second);
+XMLApplication::~XMLApplication()
+{
+ ListenerService* listener=getServiceProvider().getListenerService(false);
+ if (listener && SPConfig::getConfig().isEnabled(SPConfig::OutOfProcess) && !SPConfig::getConfig().isEnabled(SPConfig::InProcess)) {
+ string addr=string(getId()) + "::getHeaders::Application";
+ listener->unregListener(addr.c_str(), this);
+ }
+}
+
+template <class T> T* XMLApplication::doChainedPlugins(
+ PluginManager<T,string,const DOMElement*>& pluginMgr,
+ const char* pluginType,
+ const char* chainingType,
+ const XMLCh* localName,
+ DOMElement* e,
+ Category& log,
+ const char* dummyType
+ )
+{
+ string t;
+ DOMElement* child = XMLHelper::getFirstChildElement(e, localName);
+ if (child) {
+ // Check for multiple.
+ if (XMLHelper::getNextSiblingElement(child, localName)) {
+ log.info("multiple %s plugins, wrapping in a chain", pluginType);
+ DOMElement* chain = child->getOwnerDocument()->createElementNS(nullptr, localName);
+ while (child) {
+ chain->appendChild(child);
+ child = XMLHelper::getFirstChildElement(e, localName);
+ }
+ t = chainingType;
+ child = chain;
+ e->appendChild(chain);
+ }
+ else {
+ // Only a single one.
+ t = XMLHelper::getAttrString(child, nullptr, _type);
+ }
+
+ try {
+ if (!t.empty()) {
+ log.info("building %s of type %s...", pluginType, t.c_str());
+ return pluginMgr.newPlugin(t.c_str(), child);
+ }
+ else {
+ throw ConfigurationException("$1 element had no type attribute.", params(1, pluginType));
+ }
+ }
+ catch (std::exception& ex) {
+ log.crit("error building %s: %s", pluginType, ex.what());
+ if (dummyType) {
+ // Install a dummy version as a safety valve.
+ log.crit("installing safe %s in place of failed version", pluginType);
+ return pluginMgr.newPlugin(dummyType, nullptr);
+ }
+ }
+ }
+
+ return nullptr;
+}
+
+void XMLApplication::doAttributeInfo()
+{
+ // Populate prefix pair.
+ m_attributePrefix.second = "HTTP_";
+ pair<bool,const char*> prefix = getString("attributePrefix");
+ if (prefix.first) {
+ m_attributePrefix.first = prefix.second;
+ const char* pch = prefix.second;
+ while (*pch) {
+ m_attributePrefix.second += (isalnum(*pch) ? toupper(*pch) : '_');
+ pch++;
+ }
+ }
+
+ pair<bool,const char*> attributes = getString("REMOTE_USER");
+ if (attributes.first) {
+ string dup(attributes.second);
+ trim(dup);
+ split(m_remoteUsers, dup, is_space(), algorithm::token_compress_on);
+ }
+
+ // Load attribute ID lists for REMOTE_USER and header clearing.
+ if (SPConfig::getConfig().isEnabled(SPConfig::InProcess)) {
+ attributes = getString("unsetHeaders");
+ if (attributes.first) {
+ string transformedprefix(m_attributePrefix.second);
+ const char* pch;
+ prefix = getString("metadataAttributePrefix");
+ if (prefix.first) {
+ pch = prefix.second;
+ while (*pch) {
+ transformedprefix += (isalnum(*pch) ? toupper(*pch) : '_');
+ pch++;