changeset 953:b727e7352440

updated Tests/CheckHttpServerSecurity.py
author Sebastien Jodogne <s.jodogne@gmail.com>
date Fri, 14 Aug 2026 18:10:14 +0200
parents ee46f818aa63
children f3f666d432bf
files Tests/CheckHttpServerSecurity.py
diffstat 1 files changed, 31 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/Tests/CheckHttpServerSecurity.py	Fri Aug 14 17:31:29 2026 +0200
+++ b/Tests/CheckHttpServerSecurity.py	Fri Aug 14 18:10:14 2026 +0200
@@ -43,11 +43,14 @@
 os.mkdir(TMP)
 
 
-ORTHANC = Toolbox.DefineOrthanc(username = 'orthanc',
-                                password = 'orthanc')
 
 
-def IsHttpServerSecure(config):
+def IsHttpServerSecure(config,
+                       username = 'orthanc',
+                       password = 'orthanc'):
+    ORTHANC = Toolbox.DefineOrthanc(username = username,
+                                    password = password)
+
     with open(CONFIG, 'w') as f:
         f.write(json.dumps(config))
     
@@ -98,13 +101,27 @@
             'RegisteredUsers' : { }
             }))
 
-print('==== TEST 3 ====')
-Assert(True, IsHttpServerSecure({
+print('==== TEST 3a ====')
+Assert(False, IsHttpServerSecure({
             'RemoteAccessAllowed': False,
             'AuthenticationEnabled': True,
             'RegisteredUsers' : { 'orthanc' : 'orthanc' }
             }))
 
+print('==== TEST 3b ====')
+Assert(False, IsHttpServerSecure({
+            'RemoteAccessAllowed': False,
+            'AuthenticationEnabled': True,
+            'RegisteredUsers' : { 'alice' : 'orthanctest' }
+            }, 'alice', 'orthanctest'))
+
+print('==== TEST 3c ====')
+Assert(True, IsHttpServerSecure({
+            'RemoteAccessAllowed': False,
+            'AuthenticationEnabled': True,
+            'RegisteredUsers' : { 'orthanc' : 'SECURE' }
+            }, 'orthanc', 'SECURE'))
+
 print('==== TEST 4 ====')  # Orthanc refuses to start since Orthanc 1.13.0
 Assert(None, IsHttpServerSecure({
             'RemoteAccessAllowed': True
@@ -116,13 +133,20 @@
             'AuthenticationEnabled': False,
             }))
 
-print('==== TEST 6 ====')
-Assert(True, IsHttpServerSecure({
+print('==== TEST 6a ====')
+Assert(False, IsHttpServerSecure({
             'RemoteAccessAllowed': True,
             'AuthenticationEnabled': True,
             'RegisteredUsers' : { 'orthanc' : 'orthanc' }
             }))
 
+print('==== TEST 6b ====')
+Assert(True, IsHttpServerSecure({
+            'RemoteAccessAllowed': True,
+            'AuthenticationEnabled': True,
+            'RegisteredUsers' : { 'orthanc' : 'SECURE' }
+            }, 'orthanc', 'SECURE'))
+
 print('==== TEST 7 (Docker scenario) ====')  # Orthanc refuses to start since Orthanc 1.13.0
 Assert(None, IsHttpServerSecure({
             'RemoteAccessAllowed': True,