Selaa lähdekoodia

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 vuotta sitten
vanhempi
commit
d125f712fa
3 muutettua tiedostoa jossa 13 lisäystä ja 3 poistoa
  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 "jsonhelpers.hpp"
 #include "dasds.hpp"
+#include "daclient.hpp"
 
 #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
     }
 #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;
+    }
 
     processName.set(procname);
     const char* authDomain = bnd_cfg->queryProp("@authDomain");

+ 1 - 0
esp/platform/espcfg.cpp

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

+ 0 - 2
esp/platform/espcfg.ipp

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