diff Plugin/Plugin.cpp @ 54:317b31e99501

Added 3 new configurations: WebServiceUsername, WebServicePassword, WebServiceIdentifier. WebServiceIdentifier is now included in the payload as the 'identifier' field
author Alain Mazy <am@osimis.io>
date Mon, 26 Sep 2022 15:20:39 +0200
parents 6190b564622f
children c02f0646297d
line wrap: on
line diff
--- a/Plugin/Plugin.cpp	Fri May 13 09:51:18 2022 +0200
+++ b/Plugin/Plugin.cpp	Mon Sep 26 15:20:39 2022 +0200
@@ -348,9 +348,24 @@
           }
         }
 
+        std::unique_ptr<OrthancPlugins::AuthorizationWebService> webService(new OrthancPlugins::AuthorizationWebService(url));
+
+        std::string webServiceIdentifier;
+        if (configuration.LookupStringValue(webServiceIdentifier, "WebServiceIdentifier"))
+        {
+          webService->SetIdentifier(webServiceIdentifier);
+        }
+
+        std::string webServiceUsername;
+        std::string webServicePassword;
+        if (configuration.LookupStringValue(webServiceUsername, "WebServiceUsername") && configuration.LookupStringValue(webServicePassword, "WebServicePassword"))
+        {
+          webService->SetCredentials(webServiceUsername, webServicePassword);
+        }
+
         authorizationService_.reset
           (new OrthancPlugins::CachedAuthorizationService
-           (new OrthancPlugins::AuthorizationWebService(url), factory));
+           (webService.release(), factory));
 
         OrthancPluginRegisterOnChangeCallback(context, OnChangeCallback);