Browse Source

HPCC-18070 Move ensureSDSSessionDomains() call to initDali()

The ensureSDSSessionDomains() should be called only if dali is
used by an ESP. ESP session authentication is disabled if no
dali connection. Errors will be sent if there is session
configuration but no dali connection.

Signed-off-by: wangkx <kevin.wang@lexisnexis.com>
wangkx 8 years ago
parent
commit
d125f712fa
3 changed files with 13 additions and 3 deletions
  1. 12 1
      esp/bindings/http/platform/httpbinding.cpp
  2. 1 0
      esp/platform/espcfg.cpp
  3. 0 2
      esp/platform/espcfg.ipp

+ 12 - 1
esp/bindings/http/platform/httpbinding.cpp

@@ -46,6 +46,7 @@
 #include "espsecurecontext.hpp"
 #include "espsecurecontext.hpp"
 #include "jsonhelpers.hpp"
 #include "jsonhelpers.hpp"
 #include "dasds.hpp"
 #include "dasds.hpp"
+#include "daclient.hpp"
 
 
 #define FILE_UPLOAD     "FileUploadAccess"
 #define FILE_UPLOAD     "FileUploadAccess"
 
 
@@ -270,8 +271,18 @@ EspHttpBinding::EspHttpBinding(IPropertyTree* tree, const char *bindname, const
             memCachedInitString.set("--SERVER=127.0.0.1");//using local memcached server
             memCachedInitString.set("--SERVER=127.0.0.1");//using local memcached server
     }
     }
 #endif
 #endif
-    if (!m_secmgr.get())
+    if (!m_secmgr.get() || !daliClientActive())
+    {
+        if (!daliClientActive())
+        {
+            if (proc_cfg->hasProp("AuthDomains"))
+                throw MakeStringException(-1, "ESP cannot have an 'AuthDomains' setting because no dali connection is available.");
+            if (bnd_cfg->hasProp("@authDomain"))
+                throw MakeStringException(-1, "ESP Binding %s cannot have an '@authDomain' setting because no dali connection is available.", bindname);
+        }
+        domainAuthType = AuthPerRequestOnly;
         return;
         return;
+    }
 
 
     processName.set(procname);
     processName.set(procname);
     const char* authDomain = bnd_cfg->queryProp("@authDomain");
     const char* authDomain = bnd_cfg->queryProp("@authDomain");

+ 1 - 0
esp/platform/espcfg.cpp

@@ -372,6 +372,7 @@ void CEspConfig::initDali(const char *servers)
         setPasswordsFromSDS();
         setPasswordsFromSDS();
 
 
         serverstatus = new CSDSServerStatus("ESPserver");
         serverstatus = new CSDSServerStatus("ESPserver");
+        ensureSDSSessionDomains();
     }
     }
 }
 }
 
 

+ 0 - 2
esp/platform/espcfg.ipp

@@ -177,8 +177,6 @@ public:
 
 
     void loadAll()
     void loadAll()
     {
     {
-        ensureSDSSessionDomains();
-
         DBGLOG("loadServices");
         DBGLOG("loadServices");
         loadServices();
         loadServices();
         loadProtocols();
         loadProtocols();