annotate OrthancFramework/Sources/WebServiceParameters.cpp @ 5321:5fae323b11ed

added OrthancPlugins::DicomInstance::Load()
author Sebastien Jodogne <s.jodogne@gmail.com>
date Sat, 24 Jun 2023 12:43:10 +0200
parents 0ea402b4d901
children 48b8dae6dc77
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
808
2d9a000aa3a6 update/delete peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1 /**
2d9a000aa3a6 update/delete peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2 * Orthanc - A Lightweight, RESTful DICOM Store
1900
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1288
diff changeset
3 * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics
1288
6e7e5ed91c2d upgrade to year 2015
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 831
diff changeset
4 * Department, University Hospital of Liege, Belgium
5185
0ea402b4d901 upgrade to year 2023
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4870
diff changeset
5 * Copyright (C) 2017-2023 Osimis S.A., Belgium
0ea402b4d901 upgrade to year 2023
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4870
diff changeset
6 * Copyright (C) 2021-2023 Sebastien Jodogne, ICTEAM UCLouvain, Belgium
808
2d9a000aa3a6 update/delete peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7 *
2d9a000aa3a6 update/delete peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8 * This program is free software: you can redistribute it and/or
4119
bf7b9edf6b81 re-licensing the OrthancFramework to LGPL, in order to license Stone of Orthanc under LGPL
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4087
diff changeset
9 * modify it under the terms of the GNU Lesser General Public License
bf7b9edf6b81 re-licensing the OrthancFramework to LGPL, in order to license Stone of Orthanc under LGPL
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4087
diff changeset
10 * as published by the Free Software Foundation, either version 3 of
bf7b9edf6b81 re-licensing the OrthancFramework to LGPL, in order to license Stone of Orthanc under LGPL
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4087
diff changeset
11 * the License, or (at your option) any later version.
808
2d9a000aa3a6 update/delete peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
12 *
2d9a000aa3a6 update/delete peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
13 * This program is distributed in the hope that it will be useful, but
2d9a000aa3a6 update/delete peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
14 * WITHOUT ANY WARRANTY; without even the implied warranty of
2d9a000aa3a6 update/delete peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
4119
bf7b9edf6b81 re-licensing the OrthancFramework to LGPL, in order to license Stone of Orthanc under LGPL
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4087
diff changeset
16 * Lesser General Public License for more details.
808
2d9a000aa3a6 update/delete peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
17 *
4119
bf7b9edf6b81 re-licensing the OrthancFramework to LGPL, in order to license Stone of Orthanc under LGPL
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4087
diff changeset
18 * You should have received a copy of the GNU Lesser General Public
bf7b9edf6b81 re-licensing the OrthancFramework to LGPL, in order to license Stone of Orthanc under LGPL
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4087
diff changeset
19 * License along with this program. If not, see
bf7b9edf6b81 re-licensing the OrthancFramework to LGPL, in order to license Stone of Orthanc under LGPL
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4087
diff changeset
20 * <http://www.gnu.org/licenses/>.
808
2d9a000aa3a6 update/delete peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
21 **/
2d9a000aa3a6 update/delete peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
22
2d9a000aa3a6 update/delete peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
23
2020
a0bd8cd55da7 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2019
diff changeset
24 #include "PrecompiledHeaders.h"
a0bd8cd55da7 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2019
diff changeset
25 #include "WebServiceParameters.h"
808
2d9a000aa3a6 update/delete peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
26
2659
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2655
diff changeset
27 #include "Logging.h"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2655
diff changeset
28 #include "OrthancException.h"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2655
diff changeset
29 #include "SerializationToolbox.h"
2800
dc7330089736 "OrthancPeers" configuration option now allows to specify HTTP headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2779
diff changeset
30 #include "Toolbox.h"
808
2d9a000aa3a6 update/delete peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
31
2145
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2143
diff changeset
32 #if ORTHANC_SANDBOXED == 0
2800
dc7330089736 "OrthancPeers" configuration option now allows to specify HTTP headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2779
diff changeset
33 # include "SystemToolbox.h"
2145
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2143
diff changeset
34 #endif
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2143
diff changeset
35
4072
3dda0d73193c fix doxygen, more tolerant WebServiceParameters::SetUrl()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4044
diff changeset
36 #include <boost/algorithm/string/find.hpp>
2021
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2020
diff changeset
37 #include <cassert>
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2020
diff changeset
38
808
2d9a000aa3a6 update/delete peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
39 namespace Orthanc
2d9a000aa3a6 update/delete peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
40 {
2800
dc7330089736 "OrthancPeers" configuration option now allows to specify HTTP headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2779
diff changeset
41 static const char* KEY_CERTIFICATE_FILE = "CertificateFile";
dc7330089736 "OrthancPeers" configuration option now allows to specify HTTP headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2779
diff changeset
42 static const char* KEY_CERTIFICATE_KEY_FILE = "CertificateKeyFile";
dc7330089736 "OrthancPeers" configuration option now allows to specify HTTP headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2779
diff changeset
43 static const char* KEY_CERTIFICATE_KEY_PASSWORD = "CertificateKeyPassword";
dc7330089736 "OrthancPeers" configuration option now allows to specify HTTP headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2779
diff changeset
44 static const char* KEY_HTTP_HEADERS = "HttpHeaders";
dc7330089736 "OrthancPeers" configuration option now allows to specify HTTP headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2779
diff changeset
45 static const char* KEY_PASSWORD = "Password";
dc7330089736 "OrthancPeers" configuration option now allows to specify HTTP headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2779
diff changeset
46 static const char* KEY_PKCS11 = "Pkcs11";
dc7330089736 "OrthancPeers" configuration option now allows to specify HTTP headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2779
diff changeset
47 static const char* KEY_URL = "Url";
dc7330089736 "OrthancPeers" configuration option now allows to specify HTTP headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2779
diff changeset
48 static const char* KEY_URL_2 = "URL";
dc7330089736 "OrthancPeers" configuration option now allows to specify HTTP headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2779
diff changeset
49 static const char* KEY_USERNAME = "Username";
4522
017ab543e6ef added field "Timeout" in "OrthancPeers" configuration option
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
50 static const char* KEY_TIMEOUT = "Timeout";
2800
dc7330089736 "OrthancPeers" configuration option now allows to specify HTTP headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2779
diff changeset
51
dc7330089736 "OrthancPeers" configuration option now allows to specify HTTP headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2779
diff changeset
52
2823
807169f85ba9 OrthancPluginGetPeerUserProperty()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2800
diff changeset
53 static bool IsReservedKey(const std::string& key)
807169f85ba9 OrthancPluginGetPeerUserProperty()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2800
diff changeset
54 {
807169f85ba9 OrthancPluginGetPeerUserProperty()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2800
diff changeset
55 return (key == KEY_CERTIFICATE_FILE ||
807169f85ba9 OrthancPluginGetPeerUserProperty()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2800
diff changeset
56 key == KEY_CERTIFICATE_KEY_FILE ||
807169f85ba9 OrthancPluginGetPeerUserProperty()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2800
diff changeset
57 key == KEY_CERTIFICATE_KEY_PASSWORD ||
807169f85ba9 OrthancPluginGetPeerUserProperty()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2800
diff changeset
58 key == KEY_HTTP_HEADERS ||
807169f85ba9 OrthancPluginGetPeerUserProperty()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2800
diff changeset
59 key == KEY_PASSWORD ||
807169f85ba9 OrthancPluginGetPeerUserProperty()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2800
diff changeset
60 key == KEY_PKCS11 ||
807169f85ba9 OrthancPluginGetPeerUserProperty()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2800
diff changeset
61 key == KEY_URL ||
807169f85ba9 OrthancPluginGetPeerUserProperty()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2800
diff changeset
62 key == KEY_URL_2 ||
4522
017ab543e6ef added field "Timeout" in "OrthancPeers" configuration option
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
63 key == KEY_USERNAME ||
017ab543e6ef added field "Timeout" in "OrthancPeers" configuration option
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
64 key == KEY_TIMEOUT);
2823
807169f85ba9 OrthancPluginGetPeerUserProperty()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2800
diff changeset
65 }
807169f85ba9 OrthancPluginGetPeerUserProperty()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2800
diff changeset
66
807169f85ba9 OrthancPluginGetPeerUserProperty()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2800
diff changeset
67
2020
a0bd8cd55da7 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2019
diff changeset
68 WebServiceParameters::WebServiceParameters() :
4522
017ab543e6ef added field "Timeout" in "OrthancPeers" configuration option
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
69 pkcs11Enabled_(false),
017ab543e6ef added field "Timeout" in "OrthancPeers" configuration option
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
70 timeout_(0)
808
2d9a000aa3a6 update/delete peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
71 {
2800
dc7330089736 "OrthancPeers" configuration option now allows to specify HTTP headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2779
diff changeset
72 SetUrl("http://127.0.0.1:8042/");
808
2d9a000aa3a6 update/delete peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
73 }
2d9a000aa3a6 update/delete peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
74
4300
b30a8de92ad9 abi continued
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4194
diff changeset
75 WebServiceParameters::WebServiceParameters(const Json::Value &serialized)
b30a8de92ad9 abi continued
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4194
diff changeset
76 {
b30a8de92ad9 abi continued
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4194
diff changeset
77 Unserialize(serialized);
b30a8de92ad9 abi continued
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4194
diff changeset
78 }
b30a8de92ad9 abi continued
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4194
diff changeset
79
b30a8de92ad9 abi continued
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4194
diff changeset
80 const std::string &WebServiceParameters::GetUrl() const
b30a8de92ad9 abi continued
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4194
diff changeset
81 {
b30a8de92ad9 abi continued
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4194
diff changeset
82 return url_;
b30a8de92ad9 abi continued
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4194
diff changeset
83 }
b30a8de92ad9 abi continued
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4194
diff changeset
84
808
2d9a000aa3a6 update/delete peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
85
2022
fefbe71c2272 Possibility to use PKCS#11 authentication for hardware security modules with Orthanc peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2021
diff changeset
86 void WebServiceParameters::ClearClientCertificate()
fefbe71c2272 Possibility to use PKCS#11 authentication for hardware security modules with Orthanc peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2021
diff changeset
87 {
fefbe71c2272 Possibility to use PKCS#11 authentication for hardware security modules with Orthanc peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2021
diff changeset
88 certificateFile_.clear();
fefbe71c2272 Possibility to use PKCS#11 authentication for hardware security modules with Orthanc peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2021
diff changeset
89 certificateKeyFile_.clear();
fefbe71c2272 Possibility to use PKCS#11 authentication for hardware security modules with Orthanc peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2021
diff changeset
90 certificateKeyPassword_.clear();
fefbe71c2272 Possibility to use PKCS#11 authentication for hardware security modules with Orthanc peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2021
diff changeset
91 }
fefbe71c2272 Possibility to use PKCS#11 authentication for hardware security modules with Orthanc peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2021
diff changeset
92
fefbe71c2272 Possibility to use PKCS#11 authentication for hardware security modules with Orthanc peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2021
diff changeset
93
2800
dc7330089736 "OrthancPeers" configuration option now allows to specify HTTP headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2779
diff changeset
94 void WebServiceParameters::SetUrl(const std::string& url)
dc7330089736 "OrthancPeers" configuration option now allows to specify HTTP headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2779
diff changeset
95 {
4072
3dda0d73193c fix doxygen, more tolerant WebServiceParameters::SetUrl()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4044
diff changeset
96 if (boost::find_first(url, "://"))
2800
dc7330089736 "OrthancPeers" configuration option now allows to specify HTTP headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2779
diff changeset
97 {
4072
3dda0d73193c fix doxygen, more tolerant WebServiceParameters::SetUrl()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4044
diff changeset
98 // Only allow the HTTP and HTTPS protocols
3dda0d73193c fix doxygen, more tolerant WebServiceParameters::SetUrl()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4044
diff changeset
99 if (!Toolbox::StartsWith(url, "http://") &&
3dda0d73193c fix doxygen, more tolerant WebServiceParameters::SetUrl()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4044
diff changeset
100 !Toolbox::StartsWith(url, "https://"))
3dda0d73193c fix doxygen, more tolerant WebServiceParameters::SetUrl()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4044
diff changeset
101 {
3dda0d73193c fix doxygen, more tolerant WebServiceParameters::SetUrl()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4044
diff changeset
102 throw OrthancException(ErrorCode_BadFileFormat, "Bad URL: " + url);
3dda0d73193c fix doxygen, more tolerant WebServiceParameters::SetUrl()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4044
diff changeset
103 }
3dda0d73193c fix doxygen, more tolerant WebServiceParameters::SetUrl()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4044
diff changeset
104 }
3dda0d73193c fix doxygen, more tolerant WebServiceParameters::SetUrl()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4044
diff changeset
105
3dda0d73193c fix doxygen, more tolerant WebServiceParameters::SetUrl()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4044
diff changeset
106 if (url.empty())
3dda0d73193c fix doxygen, more tolerant WebServiceParameters::SetUrl()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4044
diff changeset
107 {
3dda0d73193c fix doxygen, more tolerant WebServiceParameters::SetUrl()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4044
diff changeset
108 throw OrthancException(ErrorCode_BadFileFormat, "Empty URL");
2800
dc7330089736 "OrthancPeers" configuration option now allows to specify HTTP headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2779
diff changeset
109 }
dc7330089736 "OrthancPeers" configuration option now allows to specify HTTP headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2779
diff changeset
110
dc7330089736 "OrthancPeers" configuration option now allows to specify HTTP headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2779
diff changeset
111 // Add trailing slash if needed
dc7330089736 "OrthancPeers" configuration option now allows to specify HTTP headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2779
diff changeset
112 if (url[url.size() - 1] == '/')
dc7330089736 "OrthancPeers" configuration option now allows to specify HTTP headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2779
diff changeset
113 {
dc7330089736 "OrthancPeers" configuration option now allows to specify HTTP headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2779
diff changeset
114 url_ = url;
dc7330089736 "OrthancPeers" configuration option now allows to specify HTTP headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2779
diff changeset
115 }
dc7330089736 "OrthancPeers" configuration option now allows to specify HTTP headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2779
diff changeset
116 else
dc7330089736 "OrthancPeers" configuration option now allows to specify HTTP headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2779
diff changeset
117 {
dc7330089736 "OrthancPeers" configuration option now allows to specify HTTP headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2779
diff changeset
118 url_ = url + '/';
dc7330089736 "OrthancPeers" configuration option now allows to specify HTTP headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2779
diff changeset
119 }
dc7330089736 "OrthancPeers" configuration option now allows to specify HTTP headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2779
diff changeset
120 }
dc7330089736 "OrthancPeers" configuration option now allows to specify HTTP headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2779
diff changeset
121
dc7330089736 "OrthancPeers" configuration option now allows to specify HTTP headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2779
diff changeset
122
dc7330089736 "OrthancPeers" configuration option now allows to specify HTTP headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2779
diff changeset
123 void WebServiceParameters::ClearCredentials()
dc7330089736 "OrthancPeers" configuration option now allows to specify HTTP headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2779
diff changeset
124 {
dc7330089736 "OrthancPeers" configuration option now allows to specify HTTP headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2779
diff changeset
125 username_.clear();
dc7330089736 "OrthancPeers" configuration option now allows to specify HTTP headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2779
diff changeset
126 password_.clear();
dc7330089736 "OrthancPeers" configuration option now allows to specify HTTP headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2779
diff changeset
127 }
dc7330089736 "OrthancPeers" configuration option now allows to specify HTTP headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2779
diff changeset
128
dc7330089736 "OrthancPeers" configuration option now allows to specify HTTP headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2779
diff changeset
129
dc7330089736 "OrthancPeers" configuration option now allows to specify HTTP headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2779
diff changeset
130 void WebServiceParameters::SetCredentials(const std::string& username,
dc7330089736 "OrthancPeers" configuration option now allows to specify HTTP headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2779
diff changeset
131 const std::string& password)
dc7330089736 "OrthancPeers" configuration option now allows to specify HTTP headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2779
diff changeset
132 {
dc7330089736 "OrthancPeers" configuration option now allows to specify HTTP headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2779
diff changeset
133 if (username.empty() &&
dc7330089736 "OrthancPeers" configuration option now allows to specify HTTP headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2779
diff changeset
134 !password.empty())
dc7330089736 "OrthancPeers" configuration option now allows to specify HTTP headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2779
diff changeset
135 {
dc7330089736 "OrthancPeers" configuration option now allows to specify HTTP headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2779
diff changeset
136 throw OrthancException(ErrorCode_BadFileFormat);
dc7330089736 "OrthancPeers" configuration option now allows to specify HTTP headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2779
diff changeset
137 }
dc7330089736 "OrthancPeers" configuration option now allows to specify HTTP headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2779
diff changeset
138 else
dc7330089736 "OrthancPeers" configuration option now allows to specify HTTP headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2779
diff changeset
139 {
dc7330089736 "OrthancPeers" configuration option now allows to specify HTTP headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2779
diff changeset
140 username_ = username;
dc7330089736 "OrthancPeers" configuration option now allows to specify HTTP headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2779
diff changeset
141 password_ = password;
dc7330089736 "OrthancPeers" configuration option now allows to specify HTTP headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2779
diff changeset
142 }
dc7330089736 "OrthancPeers" configuration option now allows to specify HTTP headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2779
diff changeset
143 }
dc7330089736 "OrthancPeers" configuration option now allows to specify HTTP headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2779
diff changeset
144
4300
b30a8de92ad9 abi continued
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4194
diff changeset
145 const std::string &WebServiceParameters::GetUsername() const
b30a8de92ad9 abi continued
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4194
diff changeset
146 {
b30a8de92ad9 abi continued
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4194
diff changeset
147 return username_;
b30a8de92ad9 abi continued
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4194
diff changeset
148 }
b30a8de92ad9 abi continued
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4194
diff changeset
149
b30a8de92ad9 abi continued
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4194
diff changeset
150 const std::string &WebServiceParameters::GetPassword() const
b30a8de92ad9 abi continued
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4194
diff changeset
151 {
b30a8de92ad9 abi continued
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4194
diff changeset
152 return password_;
b30a8de92ad9 abi continued
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4194
diff changeset
153 }
b30a8de92ad9 abi continued
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4194
diff changeset
154
2800
dc7330089736 "OrthancPeers" configuration option now allows to specify HTTP headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2779
diff changeset
155
2020
a0bd8cd55da7 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2019
diff changeset
156 void WebServiceParameters::SetClientCertificate(const std::string& certificateFile,
a0bd8cd55da7 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2019
diff changeset
157 const std::string& certificateKeyFile,
a0bd8cd55da7 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2019
diff changeset
158 const std::string& certificateKeyPassword)
2019
9c9332e486ca HTTPS client certificates can be associated with Orthanc peers to enhance security over Internet
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
159 {
9c9332e486ca HTTPS client certificates can be associated with Orthanc peers to enhance security over Internet
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
160 if (certificateFile.empty())
9c9332e486ca HTTPS client certificates can be associated with Orthanc peers to enhance security over Internet
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
161 {
9c9332e486ca HTTPS client certificates can be associated with Orthanc peers to enhance security over Internet
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
162 throw OrthancException(ErrorCode_ParameterOutOfRange);
9c9332e486ca HTTPS client certificates can be associated with Orthanc peers to enhance security over Internet
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
163 }
9c9332e486ca HTTPS client certificates can be associated with Orthanc peers to enhance security over Internet
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
164
2800
dc7330089736 "OrthancPeers" configuration option now allows to specify HTTP headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2779
diff changeset
165 if (certificateKeyPassword.empty())
2019
9c9332e486ca HTTPS client certificates can be associated with Orthanc peers to enhance security over Internet
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
166 {
4194
2bc49197f806 HTTP client: allow empty CertificateKeyPassword
Alain Mazy <alain@mazy.be>
parents: 4119
diff changeset
167 LOG(WARNING) << "No password specified for certificate key file: " << certificateKeyFile;
2019
9c9332e486ca HTTPS client certificates can be associated with Orthanc peers to enhance security over Internet
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
168 }
9c9332e486ca HTTPS client certificates can be associated with Orthanc peers to enhance security over Internet
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
169
9c9332e486ca HTTPS client certificates can be associated with Orthanc peers to enhance security over Internet
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
170 certificateFile_ = certificateFile;
9c9332e486ca HTTPS client certificates can be associated with Orthanc peers to enhance security over Internet
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
171 certificateKeyFile_ = certificateKeyFile;
9c9332e486ca HTTPS client certificates can be associated with Orthanc peers to enhance security over Internet
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
172 certificateKeyPassword_ = certificateKeyPassword;
9c9332e486ca HTTPS client certificates can be associated with Orthanc peers to enhance security over Internet
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
173 }
9c9332e486ca HTTPS client certificates can be associated with Orthanc peers to enhance security over Internet
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
174
4300
b30a8de92ad9 abi continued
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4194
diff changeset
175 const std::string &WebServiceParameters::GetCertificateFile() const
b30a8de92ad9 abi continued
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4194
diff changeset
176 {
b30a8de92ad9 abi continued
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4194
diff changeset
177 return certificateFile_;
b30a8de92ad9 abi continued
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4194
diff changeset
178 }
b30a8de92ad9 abi continued
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4194
diff changeset
179
b30a8de92ad9 abi continued
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4194
diff changeset
180 const std::string &WebServiceParameters::GetCertificateKeyFile() const
b30a8de92ad9 abi continued
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4194
diff changeset
181 {
b30a8de92ad9 abi continued
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4194
diff changeset
182 return certificateKeyFile_;
b30a8de92ad9 abi continued
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4194
diff changeset
183 }
b30a8de92ad9 abi continued
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4194
diff changeset
184
b30a8de92ad9 abi continued
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4194
diff changeset
185 const std::string &WebServiceParameters::GetCertificateKeyPassword() const
b30a8de92ad9 abi continued
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4194
diff changeset
186 {
b30a8de92ad9 abi continued
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4194
diff changeset
187 return certificateKeyPassword_;
b30a8de92ad9 abi continued
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4194
diff changeset
188 }
b30a8de92ad9 abi continued
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4194
diff changeset
189
b30a8de92ad9 abi continued
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4194
diff changeset
190 void WebServiceParameters::SetPkcs11Enabled(bool enabled)
b30a8de92ad9 abi continued
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4194
diff changeset
191 {
b30a8de92ad9 abi continued
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4194
diff changeset
192 pkcs11Enabled_ = enabled;
b30a8de92ad9 abi continued
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4194
diff changeset
193 }
b30a8de92ad9 abi continued
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4194
diff changeset
194
b30a8de92ad9 abi continued
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4194
diff changeset
195 bool WebServiceParameters::IsPkcs11Enabled() const
b30a8de92ad9 abi continued
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4194
diff changeset
196 {
b30a8de92ad9 abi continued
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4194
diff changeset
197 return pkcs11Enabled_;
b30a8de92ad9 abi continued
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4194
diff changeset
198 }
b30a8de92ad9 abi continued
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4194
diff changeset
199
b30a8de92ad9 abi continued
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4194
diff changeset
200 void WebServiceParameters::AddHttpHeader(const std::string &key, const std::string &value)
b30a8de92ad9 abi continued
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4194
diff changeset
201 {
b30a8de92ad9 abi continued
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4194
diff changeset
202 headers_[key] = value;
b30a8de92ad9 abi continued
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4194
diff changeset
203 }
b30a8de92ad9 abi continued
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4194
diff changeset
204
b30a8de92ad9 abi continued
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4194
diff changeset
205 void WebServiceParameters::ClearHttpHeaders()
b30a8de92ad9 abi continued
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4194
diff changeset
206 {
b30a8de92ad9 abi continued
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4194
diff changeset
207 headers_.clear();
b30a8de92ad9 abi continued
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4194
diff changeset
208 }
b30a8de92ad9 abi continued
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4194
diff changeset
209
b30a8de92ad9 abi continued
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4194
diff changeset
210 const WebServiceParameters::Dictionary &WebServiceParameters::GetHttpHeaders() const
b30a8de92ad9 abi continued
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4194
diff changeset
211 {
b30a8de92ad9 abi continued
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4194
diff changeset
212 return headers_;
b30a8de92ad9 abi continued
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4194
diff changeset
213 }
b30a8de92ad9 abi continued
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4194
diff changeset
214
2019
9c9332e486ca HTTPS client certificates can be associated with Orthanc peers to enhance security over Internet
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
215
2800
dc7330089736 "OrthancPeers" configuration option now allows to specify HTTP headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2779
diff changeset
216 void WebServiceParameters::FromSimpleFormat(const Json::Value& peer)
2019
9c9332e486ca HTTPS client certificates can be associated with Orthanc peers to enhance security over Internet
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
217 {
9c9332e486ca HTTPS client certificates can be associated with Orthanc peers to enhance security over Internet
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
218 assert(peer.isArray());
9c9332e486ca HTTPS client certificates can be associated with Orthanc peers to enhance security over Internet
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
219
2022
fefbe71c2272 Possibility to use PKCS#11 authentication for hardware security modules with Orthanc peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2021
diff changeset
220 pkcs11Enabled_ = false;
4522
017ab543e6ef added field "Timeout" in "OrthancPeers" configuration option
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
221 timeout_ = 0;
2800
dc7330089736 "OrthancPeers" configuration option now allows to specify HTTP headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2779
diff changeset
222 ClearClientCertificate();
2019
9c9332e486ca HTTPS client certificates can be associated with Orthanc peers to enhance security over Internet
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
223
9c9332e486ca HTTPS client certificates can be associated with Orthanc peers to enhance security over Internet
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
224 if (peer.size() != 1 &&
9c9332e486ca HTTPS client certificates can be associated with Orthanc peers to enhance security over Internet
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
225 peer.size() != 3)
9c9332e486ca HTTPS client certificates can be associated with Orthanc peers to enhance security over Internet
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
226 {
9c9332e486ca HTTPS client certificates can be associated with Orthanc peers to enhance security over Internet
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
227 throw OrthancException(ErrorCode_BadFileFormat);
9c9332e486ca HTTPS client certificates can be associated with Orthanc peers to enhance security over Internet
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
228 }
9c9332e486ca HTTPS client certificates can be associated with Orthanc peers to enhance security over Internet
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
229
2800
dc7330089736 "OrthancPeers" configuration option now allows to specify HTTP headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2779
diff changeset
230 SetUrl(peer.get(0u, "").asString());
2019
9c9332e486ca HTTPS client certificates can be associated with Orthanc peers to enhance security over Internet
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
231
9c9332e486ca HTTPS client certificates can be associated with Orthanc peers to enhance security over Internet
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
232 if (peer.size() == 1)
9c9332e486ca HTTPS client certificates can be associated with Orthanc peers to enhance security over Internet
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
233 {
2800
dc7330089736 "OrthancPeers" configuration option now allows to specify HTTP headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2779
diff changeset
234 ClearCredentials();
2019
9c9332e486ca HTTPS client certificates can be associated with Orthanc peers to enhance security over Internet
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
235 }
2669
eaf10085ffa1 no passwords in public content of jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2659
diff changeset
236 else if (peer.size() == 2)
eaf10085ffa1 no passwords in public content of jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2659
diff changeset
237 {
2954
d924f9bb61cc taking advantage of details in OrthancException
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2823
diff changeset
238 throw OrthancException(ErrorCode_BadFileFormat,
d924f9bb61cc taking advantage of details in OrthancException
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2823
diff changeset
239 "The HTTP password is not provided");
2669
eaf10085ffa1 no passwords in public content of jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2659
diff changeset
240 }
2019
9c9332e486ca HTTPS client certificates can be associated with Orthanc peers to enhance security over Internet
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
241 else if (peer.size() == 3)
9c9332e486ca HTTPS client certificates can be associated with Orthanc peers to enhance security over Internet
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
242 {
2800
dc7330089736 "OrthancPeers" configuration option now allows to specify HTTP headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2779
diff changeset
243 SetCredentials(peer.get(1u, "").asString(),
dc7330089736 "OrthancPeers" configuration option now allows to specify HTTP headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2779
diff changeset
244 peer.get(2u, "").asString());
2019
9c9332e486ca HTTPS client certificates can be associated with Orthanc peers to enhance security over Internet
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
245 }
9c9332e486ca HTTPS client certificates can be associated with Orthanc peers to enhance security over Internet
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
246 else
9c9332e486ca HTTPS client certificates can be associated with Orthanc peers to enhance security over Internet
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
247 {
9c9332e486ca HTTPS client certificates can be associated with Orthanc peers to enhance security over Internet
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
248 throw OrthancException(ErrorCode_BadFileFormat);
9c9332e486ca HTTPS client certificates can be associated with Orthanc peers to enhance security over Internet
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
249 }
9c9332e486ca HTTPS client certificates can be associated with Orthanc peers to enhance security over Internet
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
250 }
9c9332e486ca HTTPS client certificates can be associated with Orthanc peers to enhance security over Internet
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
251
9c9332e486ca HTTPS client certificates can be associated with Orthanc peers to enhance security over Internet
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
252
9c9332e486ca HTTPS client certificates can be associated with Orthanc peers to enhance security over Internet
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
253 static std::string GetStringMember(const Json::Value& peer,
9c9332e486ca HTTPS client certificates can be associated with Orthanc peers to enhance security over Internet
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
254 const std::string& key,
9c9332e486ca HTTPS client certificates can be associated with Orthanc peers to enhance security over Internet
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
255 const std::string& defaultValue)
9c9332e486ca HTTPS client certificates can be associated with Orthanc peers to enhance security over Internet
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
256 {
9c9332e486ca HTTPS client certificates can be associated with Orthanc peers to enhance security over Internet
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
257 if (!peer.isMember(key))
9c9332e486ca HTTPS client certificates can be associated with Orthanc peers to enhance security over Internet
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
258 {
9c9332e486ca HTTPS client certificates can be associated with Orthanc peers to enhance security over Internet
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
259 return defaultValue;
9c9332e486ca HTTPS client certificates can be associated with Orthanc peers to enhance security over Internet
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
260 }
9c9332e486ca HTTPS client certificates can be associated with Orthanc peers to enhance security over Internet
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
261 else if (peer[key].type() != Json::stringValue)
9c9332e486ca HTTPS client certificates can be associated with Orthanc peers to enhance security over Internet
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
262 {
9c9332e486ca HTTPS client certificates can be associated with Orthanc peers to enhance security over Internet
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
263 throw OrthancException(ErrorCode_BadFileFormat);
9c9332e486ca HTTPS client certificates can be associated with Orthanc peers to enhance security over Internet
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
264 }
9c9332e486ca HTTPS client certificates can be associated with Orthanc peers to enhance security over Internet
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
265 else
9c9332e486ca HTTPS client certificates can be associated with Orthanc peers to enhance security over Internet
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
266 {
9c9332e486ca HTTPS client certificates can be associated with Orthanc peers to enhance security over Internet
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
267 return peer[key].asString();
9c9332e486ca HTTPS client certificates can be associated with Orthanc peers to enhance security over Internet
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
268 }
9c9332e486ca HTTPS client certificates can be associated with Orthanc peers to enhance security over Internet
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
269 }
9c9332e486ca HTTPS client certificates can be associated with Orthanc peers to enhance security over Internet
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
270
9c9332e486ca HTTPS client certificates can be associated with Orthanc peers to enhance security over Internet
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
271
2800
dc7330089736 "OrthancPeers" configuration option now allows to specify HTTP headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2779
diff changeset
272 void WebServiceParameters::FromAdvancedFormat(const Json::Value& peer)
2019
9c9332e486ca HTTPS client certificates can be associated with Orthanc peers to enhance security over Internet
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
273 {
9c9332e486ca HTTPS client certificates can be associated with Orthanc peers to enhance security over Internet
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
274 assert(peer.isObject());
9c9332e486ca HTTPS client certificates can be associated with Orthanc peers to enhance security over Internet
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
275
2800
dc7330089736 "OrthancPeers" configuration option now allows to specify HTTP headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2779
diff changeset
276 std::string url = GetStringMember(peer, KEY_URL, "");
2019
9c9332e486ca HTTPS client certificates can be associated with Orthanc peers to enhance security over Internet
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
277 if (url.empty())
9c9332e486ca HTTPS client certificates can be associated with Orthanc peers to enhance security over Internet
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
278 {
2800
dc7330089736 "OrthancPeers" configuration option now allows to specify HTTP headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2779
diff changeset
279 SetUrl(GetStringMember(peer, KEY_URL_2, ""));
dc7330089736 "OrthancPeers" configuration option now allows to specify HTTP headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2779
diff changeset
280 }
dc7330089736 "OrthancPeers" configuration option now allows to specify HTTP headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2779
diff changeset
281 else
dc7330089736 "OrthancPeers" configuration option now allows to specify HTTP headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2779
diff changeset
282 {
dc7330089736 "OrthancPeers" configuration option now allows to specify HTTP headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2779
diff changeset
283 SetUrl(url);
2019
9c9332e486ca HTTPS client certificates can be associated with Orthanc peers to enhance security over Internet
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
284 }
9c9332e486ca HTTPS client certificates can be associated with Orthanc peers to enhance security over Internet
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
285
2800
dc7330089736 "OrthancPeers" configuration option now allows to specify HTTP headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2779
diff changeset
286 SetCredentials(GetStringMember(peer, KEY_USERNAME, ""),
dc7330089736 "OrthancPeers" configuration option now allows to specify HTTP headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2779
diff changeset
287 GetStringMember(peer, KEY_PASSWORD, ""));
2019
9c9332e486ca HTTPS client certificates can be associated with Orthanc peers to enhance security over Internet
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
288
2800
dc7330089736 "OrthancPeers" configuration option now allows to specify HTTP headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2779
diff changeset
289 std::string file = GetStringMember(peer, KEY_CERTIFICATE_FILE, "");
dc7330089736 "OrthancPeers" configuration option now allows to specify HTTP headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2779
diff changeset
290 if (!file.empty())
2669
eaf10085ffa1 no passwords in public content of jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2659
diff changeset
291 {
2800
dc7330089736 "OrthancPeers" configuration option now allows to specify HTTP headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2779
diff changeset
292 SetClientCertificate(file, GetStringMember(peer, KEY_CERTIFICATE_KEY_FILE, ""),
dc7330089736 "OrthancPeers" configuration option now allows to specify HTTP headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2779
diff changeset
293 GetStringMember(peer, KEY_CERTIFICATE_KEY_PASSWORD, ""));
dc7330089736 "OrthancPeers" configuration option now allows to specify HTTP headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2779
diff changeset
294 }
dc7330089736 "OrthancPeers" configuration option now allows to specify HTTP headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2779
diff changeset
295 else
dc7330089736 "OrthancPeers" configuration option now allows to specify HTTP headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2779
diff changeset
296 {
dc7330089736 "OrthancPeers" configuration option now allows to specify HTTP headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2779
diff changeset
297 ClearClientCertificate();
2669
eaf10085ffa1 no passwords in public content of jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2659
diff changeset
298 }
eaf10085ffa1 no passwords in public content of jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2659
diff changeset
299
2800
dc7330089736 "OrthancPeers" configuration option now allows to specify HTTP headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2779
diff changeset
300 if (peer.isMember(KEY_PKCS11))
2019
9c9332e486ca HTTPS client certificates can be associated with Orthanc peers to enhance security over Internet
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
301 {
2800
dc7330089736 "OrthancPeers" configuration option now allows to specify HTTP headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2779
diff changeset
302 if (peer[KEY_PKCS11].type() == Json::booleanValue)
2669
eaf10085ffa1 no passwords in public content of jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2659
diff changeset
303 {
2800
dc7330089736 "OrthancPeers" configuration option now allows to specify HTTP headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2779
diff changeset
304 pkcs11Enabled_ = peer[KEY_PKCS11].asBool();
2022
fefbe71c2272 Possibility to use PKCS#11 authentication for hardware security modules with Orthanc peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2021
diff changeset
305 }
fefbe71c2272 Possibility to use PKCS#11 authentication for hardware security modules with Orthanc peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2021
diff changeset
306 else
fefbe71c2272 Possibility to use PKCS#11 authentication for hardware security modules with Orthanc peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2021
diff changeset
307 {
fefbe71c2272 Possibility to use PKCS#11 authentication for hardware security modules with Orthanc peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2021
diff changeset
308 throw OrthancException(ErrorCode_BadFileFormat);
fefbe71c2272 Possibility to use PKCS#11 authentication for hardware security modules with Orthanc peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2021
diff changeset
309 }
fefbe71c2272 Possibility to use PKCS#11 authentication for hardware security modules with Orthanc peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2021
diff changeset
310 }
2800
dc7330089736 "OrthancPeers" configuration option now allows to specify HTTP headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2779
diff changeset
311 else
dc7330089736 "OrthancPeers" configuration option now allows to specify HTTP headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2779
diff changeset
312 {
dc7330089736 "OrthancPeers" configuration option now allows to specify HTTP headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2779
diff changeset
313 pkcs11Enabled_ = false;
dc7330089736 "OrthancPeers" configuration option now allows to specify HTTP headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2779
diff changeset
314 }
dc7330089736 "OrthancPeers" configuration option now allows to specify HTTP headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2779
diff changeset
315
2823
807169f85ba9 OrthancPluginGetPeerUserProperty()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2800
diff changeset
316
2800
dc7330089736 "OrthancPeers" configuration option now allows to specify HTTP headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2779
diff changeset
317 headers_.clear();
dc7330089736 "OrthancPeers" configuration option now allows to specify HTTP headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2779
diff changeset
318
dc7330089736 "OrthancPeers" configuration option now allows to specify HTTP headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2779
diff changeset
319 if (peer.isMember(KEY_HTTP_HEADERS))
dc7330089736 "OrthancPeers" configuration option now allows to specify HTTP headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2779
diff changeset
320 {
dc7330089736 "OrthancPeers" configuration option now allows to specify HTTP headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2779
diff changeset
321 const Json::Value& h = peer[KEY_HTTP_HEADERS];
dc7330089736 "OrthancPeers" configuration option now allows to specify HTTP headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2779
diff changeset
322 if (h.type() != Json::objectValue)
dc7330089736 "OrthancPeers" configuration option now allows to specify HTTP headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2779
diff changeset
323 {
dc7330089736 "OrthancPeers" configuration option now allows to specify HTTP headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2779
diff changeset
324 throw OrthancException(ErrorCode_BadFileFormat);
dc7330089736 "OrthancPeers" configuration option now allows to specify HTTP headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2779
diff changeset
325 }
dc7330089736 "OrthancPeers" configuration option now allows to specify HTTP headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2779
diff changeset
326 else
dc7330089736 "OrthancPeers" configuration option now allows to specify HTTP headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2779
diff changeset
327 {
dc7330089736 "OrthancPeers" configuration option now allows to specify HTTP headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2779
diff changeset
328 Json::Value::Members keys = h.getMemberNames();
dc7330089736 "OrthancPeers" configuration option now allows to specify HTTP headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2779
diff changeset
329 for (size_t i = 0; i < keys.size(); i++)
dc7330089736 "OrthancPeers" configuration option now allows to specify HTTP headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2779
diff changeset
330 {
dc7330089736 "OrthancPeers" configuration option now allows to specify HTTP headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2779
diff changeset
331 const Json::Value& value = h[keys[i]];
dc7330089736 "OrthancPeers" configuration option now allows to specify HTTP headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2779
diff changeset
332 if (value.type() != Json::stringValue)
dc7330089736 "OrthancPeers" configuration option now allows to specify HTTP headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2779
diff changeset
333 {
dc7330089736 "OrthancPeers" configuration option now allows to specify HTTP headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2779
diff changeset
334 throw OrthancException(ErrorCode_BadFileFormat);
dc7330089736 "OrthancPeers" configuration option now allows to specify HTTP headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2779
diff changeset
335 }
dc7330089736 "OrthancPeers" configuration option now allows to specify HTTP headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2779
diff changeset
336 else
dc7330089736 "OrthancPeers" configuration option now allows to specify HTTP headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2779
diff changeset
337 {
dc7330089736 "OrthancPeers" configuration option now allows to specify HTTP headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2779
diff changeset
338 headers_[keys[i]] = value.asString();
dc7330089736 "OrthancPeers" configuration option now allows to specify HTTP headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2779
diff changeset
339 }
dc7330089736 "OrthancPeers" configuration option now allows to specify HTTP headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2779
diff changeset
340 }
dc7330089736 "OrthancPeers" configuration option now allows to specify HTTP headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2779
diff changeset
341 }
dc7330089736 "OrthancPeers" configuration option now allows to specify HTTP headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2779
diff changeset
342 }
2823
807169f85ba9 OrthancPluginGetPeerUserProperty()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2800
diff changeset
343
807169f85ba9 OrthancPluginGetPeerUserProperty()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2800
diff changeset
344
807169f85ba9 OrthancPluginGetPeerUserProperty()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2800
diff changeset
345 userProperties_.clear();
807169f85ba9 OrthancPluginGetPeerUserProperty()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2800
diff changeset
346
807169f85ba9 OrthancPluginGetPeerUserProperty()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2800
diff changeset
347 const Json::Value::Members members = peer.getMemberNames();
807169f85ba9 OrthancPluginGetPeerUserProperty()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2800
diff changeset
348
807169f85ba9 OrthancPluginGetPeerUserProperty()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2800
diff changeset
349 for (Json::Value::Members::const_iterator it = members.begin();
807169f85ba9 OrthancPluginGetPeerUserProperty()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2800
diff changeset
350 it != members.end(); ++it)
807169f85ba9 OrthancPluginGetPeerUserProperty()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2800
diff changeset
351 {
807169f85ba9 OrthancPluginGetPeerUserProperty()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2800
diff changeset
352 if (!IsReservedKey(*it))
807169f85ba9 OrthancPluginGetPeerUserProperty()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2800
diff changeset
353 {
3444
6fe42a335a80 WebServiceParameters::GetBooleanUserProperty()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3192
diff changeset
354 switch (peer[*it].type())
2823
807169f85ba9 OrthancPluginGetPeerUserProperty()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2800
diff changeset
355 {
3444
6fe42a335a80 WebServiceParameters::GetBooleanUserProperty()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3192
diff changeset
356 case Json::stringValue:
6fe42a335a80 WebServiceParameters::GetBooleanUserProperty()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3192
diff changeset
357 userProperties_[*it] = peer[*it].asString();
6fe42a335a80 WebServiceParameters::GetBooleanUserProperty()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3192
diff changeset
358 break;
6fe42a335a80 WebServiceParameters::GetBooleanUserProperty()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3192
diff changeset
359
6fe42a335a80 WebServiceParameters::GetBooleanUserProperty()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3192
diff changeset
360 case Json::booleanValue:
6fe42a335a80 WebServiceParameters::GetBooleanUserProperty()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3192
diff changeset
361 userProperties_[*it] = peer[*it].asBool() ? "1" : "0";
6fe42a335a80 WebServiceParameters::GetBooleanUserProperty()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3192
diff changeset
362 break;
6fe42a335a80 WebServiceParameters::GetBooleanUserProperty()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3192
diff changeset
363
6fe42a335a80 WebServiceParameters::GetBooleanUserProperty()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3192
diff changeset
364 case Json::intValue:
6fe42a335a80 WebServiceParameters::GetBooleanUserProperty()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3192
diff changeset
365 userProperties_[*it] = boost::lexical_cast<std::string>(peer[*it].asInt());
6fe42a335a80 WebServiceParameters::GetBooleanUserProperty()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3192
diff changeset
366 break;
6fe42a335a80 WebServiceParameters::GetBooleanUserProperty()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3192
diff changeset
367
6fe42a335a80 WebServiceParameters::GetBooleanUserProperty()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3192
diff changeset
368 default:
3716
ae0e3fd609df sample for "Manufacturer" option in "DicomModalities" config
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3640
diff changeset
369 throw OrthancException(ErrorCode_BadFileFormat,
ae0e3fd609df sample for "Manufacturer" option in "DicomModalities" config
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3640
diff changeset
370 "User-defined properties associated with a Web service must be strings: " + *it);
2823
807169f85ba9 OrthancPluginGetPeerUserProperty()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2800
diff changeset
371 }
807169f85ba9 OrthancPluginGetPeerUserProperty()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2800
diff changeset
372 }
807169f85ba9 OrthancPluginGetPeerUserProperty()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2800
diff changeset
373 }
4522
017ab543e6ef added field "Timeout" in "OrthancPeers" configuration option
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
374
017ab543e6ef added field "Timeout" in "OrthancPeers" configuration option
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
375
017ab543e6ef added field "Timeout" in "OrthancPeers" configuration option
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
376 if (peer.isMember(KEY_TIMEOUT))
017ab543e6ef added field "Timeout" in "OrthancPeers" configuration option
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
377 {
017ab543e6ef added field "Timeout" in "OrthancPeers" configuration option
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
378 timeout_ = SerializationToolbox::ReadUnsignedInteger(peer, KEY_TIMEOUT);
017ab543e6ef added field "Timeout" in "OrthancPeers" configuration option
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
379 }
017ab543e6ef added field "Timeout" in "OrthancPeers" configuration option
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
380 else
017ab543e6ef added field "Timeout" in "OrthancPeers" configuration option
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
381 {
017ab543e6ef added field "Timeout" in "OrthancPeers" configuration option
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
382 timeout_ = 0;
017ab543e6ef added field "Timeout" in "OrthancPeers" configuration option
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
383 }
2019
9c9332e486ca HTTPS client certificates can be associated with Orthanc peers to enhance security over Internet
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
384 }
9c9332e486ca HTTPS client certificates can be associated with Orthanc peers to enhance security over Internet
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
385
9c9332e486ca HTTPS client certificates can be associated with Orthanc peers to enhance security over Internet
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
386
2800
dc7330089736 "OrthancPeers" configuration option now allows to specify HTTP headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2779
diff changeset
387 void WebServiceParameters::Unserialize(const Json::Value& peer)
808
2d9a000aa3a6 update/delete peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
388 {
2d9a000aa3a6 update/delete peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
389 try
2d9a000aa3a6 update/delete peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
390 {
2019
9c9332e486ca HTTPS client certificates can be associated with Orthanc peers to enhance security over Internet
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
391 if (peer.isArray())
808
2d9a000aa3a6 update/delete peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
392 {
2800
dc7330089736 "OrthancPeers" configuration option now allows to specify HTTP headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2779
diff changeset
393 FromSimpleFormat(peer);
808
2d9a000aa3a6 update/delete peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
394 }
2019
9c9332e486ca HTTPS client certificates can be associated with Orthanc peers to enhance security over Internet
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
395 else if (peer.isObject())
808
2d9a000aa3a6 update/delete peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
396 {
2800
dc7330089736 "OrthancPeers" configuration option now allows to specify HTTP headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2779
diff changeset
397 FromAdvancedFormat(peer);
808
2d9a000aa3a6 update/delete peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
398 }
2d9a000aa3a6 update/delete peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
399 else
2d9a000aa3a6 update/delete peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
400 {
2d9a000aa3a6 update/delete peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
401 throw OrthancException(ErrorCode_BadFileFormat);
2d9a000aa3a6 update/delete peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
402 }
2d9a000aa3a6 update/delete peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
403 }
2042
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2032
diff changeset
404 catch (OrthancException&)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2032
diff changeset
405 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2032
diff changeset
406 throw;
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2032
diff changeset
407 }
808
2d9a000aa3a6 update/delete peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
408 catch (...)
2d9a000aa3a6 update/delete peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
409 {
2d9a000aa3a6 update/delete peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
410 throw OrthancException(ErrorCode_BadFileFormat);
2d9a000aa3a6 update/delete peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
411 }
2d9a000aa3a6 update/delete peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
412 }
2d9a000aa3a6 update/delete peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
413
2d9a000aa3a6 update/delete peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
414
2800
dc7330089736 "OrthancPeers" configuration option now allows to specify HTTP headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2779
diff changeset
415 void WebServiceParameters::ListHttpHeaders(std::set<std::string>& target) const
dc7330089736 "OrthancPeers" configuration option now allows to specify HTTP headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2779
diff changeset
416 {
dc7330089736 "OrthancPeers" configuration option now allows to specify HTTP headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2779
diff changeset
417 target.clear();
dc7330089736 "OrthancPeers" configuration option now allows to specify HTTP headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2779
diff changeset
418
2823
807169f85ba9 OrthancPluginGetPeerUserProperty()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2800
diff changeset
419 for (Dictionary::const_iterator it = headers_.begin();
2800
dc7330089736 "OrthancPeers" configuration option now allows to specify HTTP headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2779
diff changeset
420 it != headers_.end(); ++it)
dc7330089736 "OrthancPeers" configuration option now allows to specify HTTP headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2779
diff changeset
421 {
dc7330089736 "OrthancPeers" configuration option now allows to specify HTTP headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2779
diff changeset
422 target.insert(it->first);
dc7330089736 "OrthancPeers" configuration option now allows to specify HTTP headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2779
diff changeset
423 }
dc7330089736 "OrthancPeers" configuration option now allows to specify HTTP headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2779
diff changeset
424 }
dc7330089736 "OrthancPeers" configuration option now allows to specify HTTP headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2779
diff changeset
425
dc7330089736 "OrthancPeers" configuration option now allows to specify HTTP headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2779
diff changeset
426
dc7330089736 "OrthancPeers" configuration option now allows to specify HTTP headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2779
diff changeset
427 bool WebServiceParameters::LookupHttpHeader(std::string& value,
dc7330089736 "OrthancPeers" configuration option now allows to specify HTTP headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2779
diff changeset
428 const std::string& key) const
808
2d9a000aa3a6 update/delete peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
429 {
2823
807169f85ba9 OrthancPluginGetPeerUserProperty()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2800
diff changeset
430 Dictionary::const_iterator found = headers_.find(key);
2800
dc7330089736 "OrthancPeers" configuration option now allows to specify HTTP headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2779
diff changeset
431
dc7330089736 "OrthancPeers" configuration option now allows to specify HTTP headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2779
diff changeset
432 if (found == headers_.end())
dc7330089736 "OrthancPeers" configuration option now allows to specify HTTP headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2779
diff changeset
433 {
dc7330089736 "OrthancPeers" configuration option now allows to specify HTTP headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2779
diff changeset
434 return false;
dc7330089736 "OrthancPeers" configuration option now allows to specify HTTP headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2779
diff changeset
435 }
dc7330089736 "OrthancPeers" configuration option now allows to specify HTTP headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2779
diff changeset
436 else
dc7330089736 "OrthancPeers" configuration option now allows to specify HTTP headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2779
diff changeset
437 {
dc7330089736 "OrthancPeers" configuration option now allows to specify HTTP headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2779
diff changeset
438 value = found->second;
dc7330089736 "OrthancPeers" configuration option now allows to specify HTTP headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2779
diff changeset
439 return true;
dc7330089736 "OrthancPeers" configuration option now allows to specify HTTP headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2779
diff changeset
440 }
dc7330089736 "OrthancPeers" configuration option now allows to specify HTTP headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2779
diff changeset
441 }
dc7330089736 "OrthancPeers" configuration option now allows to specify HTTP headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2779
diff changeset
442
dc7330089736 "OrthancPeers" configuration option now allows to specify HTTP headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2779
diff changeset
443
2823
807169f85ba9 OrthancPluginGetPeerUserProperty()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2800
diff changeset
444 void WebServiceParameters::AddUserProperty(const std::string& key,
807169f85ba9 OrthancPluginGetPeerUserProperty()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2800
diff changeset
445 const std::string& value)
807169f85ba9 OrthancPluginGetPeerUserProperty()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2800
diff changeset
446 {
807169f85ba9 OrthancPluginGetPeerUserProperty()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2800
diff changeset
447 if (IsReservedKey(key))
807169f85ba9 OrthancPluginGetPeerUserProperty()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2800
diff changeset
448 {
2954
d924f9bb61cc taking advantage of details in OrthancException
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2823
diff changeset
449 throw OrthancException(
d924f9bb61cc taking advantage of details in OrthancException
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2823
diff changeset
450 ErrorCode_ParameterOutOfRange,
d924f9bb61cc taking advantage of details in OrthancException
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2823
diff changeset
451 "Cannot use this reserved key to name an user property: " + key);
2823
807169f85ba9 OrthancPluginGetPeerUserProperty()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2800
diff changeset
452 }
807169f85ba9 OrthancPluginGetPeerUserProperty()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2800
diff changeset
453 else
807169f85ba9 OrthancPluginGetPeerUserProperty()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2800
diff changeset
454 {
807169f85ba9 OrthancPluginGetPeerUserProperty()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2800
diff changeset
455 userProperties_[key] = value;
807169f85ba9 OrthancPluginGetPeerUserProperty()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2800
diff changeset
456 }
807169f85ba9 OrthancPluginGetPeerUserProperty()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2800
diff changeset
457 }
807169f85ba9 OrthancPluginGetPeerUserProperty()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2800
diff changeset
458
4300
b30a8de92ad9 abi continued
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4194
diff changeset
459 void WebServiceParameters::ClearUserProperties()
b30a8de92ad9 abi continued
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4194
diff changeset
460 {
b30a8de92ad9 abi continued
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4194
diff changeset
461 userProperties_.clear();
b30a8de92ad9 abi continued
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4194
diff changeset
462 }
b30a8de92ad9 abi continued
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4194
diff changeset
463
b30a8de92ad9 abi continued
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4194
diff changeset
464 const WebServiceParameters::Dictionary &WebServiceParameters::GetUserProperties() const
b30a8de92ad9 abi continued
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4194
diff changeset
465 {
b30a8de92ad9 abi continued
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4194
diff changeset
466 return userProperties_;
b30a8de92ad9 abi continued
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4194
diff changeset
467 }
b30a8de92ad9 abi continued
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4194
diff changeset
468
2823
807169f85ba9 OrthancPluginGetPeerUserProperty()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2800
diff changeset
469
807169f85ba9 OrthancPluginGetPeerUserProperty()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2800
diff changeset
470 void WebServiceParameters::ListUserProperties(std::set<std::string>& target) const
807169f85ba9 OrthancPluginGetPeerUserProperty()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2800
diff changeset
471 {
807169f85ba9 OrthancPluginGetPeerUserProperty()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2800
diff changeset
472 target.clear();
807169f85ba9 OrthancPluginGetPeerUserProperty()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2800
diff changeset
473
807169f85ba9 OrthancPluginGetPeerUserProperty()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2800
diff changeset
474 for (Dictionary::const_iterator it = userProperties_.begin();
807169f85ba9 OrthancPluginGetPeerUserProperty()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2800
diff changeset
475 it != userProperties_.end(); ++it)
807169f85ba9 OrthancPluginGetPeerUserProperty()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2800
diff changeset
476 {
807169f85ba9 OrthancPluginGetPeerUserProperty()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2800
diff changeset
477 target.insert(it->first);
807169f85ba9 OrthancPluginGetPeerUserProperty()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2800
diff changeset
478 }
807169f85ba9 OrthancPluginGetPeerUserProperty()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2800
diff changeset
479 }
807169f85ba9 OrthancPluginGetPeerUserProperty()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2800
diff changeset
480
807169f85ba9 OrthancPluginGetPeerUserProperty()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2800
diff changeset
481
807169f85ba9 OrthancPluginGetPeerUserProperty()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2800
diff changeset
482 bool WebServiceParameters::LookupUserProperty(std::string& value,
807169f85ba9 OrthancPluginGetPeerUserProperty()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2800
diff changeset
483 const std::string& key) const
807169f85ba9 OrthancPluginGetPeerUserProperty()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2800
diff changeset
484 {
807169f85ba9 OrthancPluginGetPeerUserProperty()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2800
diff changeset
485 Dictionary::const_iterator found = userProperties_.find(key);
807169f85ba9 OrthancPluginGetPeerUserProperty()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2800
diff changeset
486
807169f85ba9 OrthancPluginGetPeerUserProperty()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2800
diff changeset
487 if (found == userProperties_.end())
807169f85ba9 OrthancPluginGetPeerUserProperty()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2800
diff changeset
488 {
807169f85ba9 OrthancPluginGetPeerUserProperty()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2800
diff changeset
489 return false;
807169f85ba9 OrthancPluginGetPeerUserProperty()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2800
diff changeset
490 }
807169f85ba9 OrthancPluginGetPeerUserProperty()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2800
diff changeset
491 else
807169f85ba9 OrthancPluginGetPeerUserProperty()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2800
diff changeset
492 {
807169f85ba9 OrthancPluginGetPeerUserProperty()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2800
diff changeset
493 value = found->second;
807169f85ba9 OrthancPluginGetPeerUserProperty()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2800
diff changeset
494 return true;
807169f85ba9 OrthancPluginGetPeerUserProperty()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2800
diff changeset
495 }
807169f85ba9 OrthancPluginGetPeerUserProperty()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2800
diff changeset
496 }
3444
6fe42a335a80 WebServiceParameters::GetBooleanUserProperty()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3192
diff changeset
497
6fe42a335a80 WebServiceParameters::GetBooleanUserProperty()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3192
diff changeset
498
6fe42a335a80 WebServiceParameters::GetBooleanUserProperty()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3192
diff changeset
499 bool WebServiceParameters::GetBooleanUserProperty(const std::string& key,
6fe42a335a80 WebServiceParameters::GetBooleanUserProperty()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3192
diff changeset
500 bool defaultValue) const
6fe42a335a80 WebServiceParameters::GetBooleanUserProperty()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3192
diff changeset
501 {
6fe42a335a80 WebServiceParameters::GetBooleanUserProperty()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3192
diff changeset
502 Dictionary::const_iterator found = userProperties_.find(key);
6fe42a335a80 WebServiceParameters::GetBooleanUserProperty()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3192
diff changeset
503
6fe42a335a80 WebServiceParameters::GetBooleanUserProperty()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3192
diff changeset
504 if (found == userProperties_.end())
6fe42a335a80 WebServiceParameters::GetBooleanUserProperty()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3192
diff changeset
505 {
6fe42a335a80 WebServiceParameters::GetBooleanUserProperty()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3192
diff changeset
506 return defaultValue;
6fe42a335a80 WebServiceParameters::GetBooleanUserProperty()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3192
diff changeset
507 }
6fe42a335a80 WebServiceParameters::GetBooleanUserProperty()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3192
diff changeset
508 else
6fe42a335a80 WebServiceParameters::GetBooleanUserProperty()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3192
diff changeset
509 {
4834
bec432ee1094 download of numpy arrays from the REST API
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4831
diff changeset
510 bool value;
bec432ee1094 download of numpy arrays from the REST API
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4831
diff changeset
511 if (SerializationToolbox::ParseBoolean(value, found->second))
bec432ee1094 download of numpy arrays from the REST API
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4831
diff changeset
512 {
bec432ee1094 download of numpy arrays from the REST API
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4831
diff changeset
513 return value;
bec432ee1094 download of numpy arrays from the REST API
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4831
diff changeset
514 }
bec432ee1094 download of numpy arrays from the REST API
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4831
diff changeset
515 else
bec432ee1094 download of numpy arrays from the REST API
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4831
diff changeset
516 {
bec432ee1094 download of numpy arrays from the REST API
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4831
diff changeset
517 throw OrthancException(ErrorCode_BadFileFormat, "Bad value for a Boolean user property in the parameters "
bec432ee1094 download of numpy arrays from the REST API
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4831
diff changeset
518 "of a Web service: Property \"" + key + "\" equals: " + found->second);
bec432ee1094 download of numpy arrays from the REST API
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4831
diff changeset
519 }
bec432ee1094 download of numpy arrays from the REST API
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4831
diff changeset
520 }
3444
6fe42a335a80 WebServiceParameters::GetBooleanUserProperty()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3192
diff changeset
521 }
2823
807169f85ba9 OrthancPluginGetPeerUserProperty()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2800
diff changeset
522
807169f85ba9 OrthancPluginGetPeerUserProperty()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2800
diff changeset
523
2800
dc7330089736 "OrthancPeers" configuration option now allows to specify HTTP headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2779
diff changeset
524 bool WebServiceParameters::IsAdvancedFormatNeeded() const
dc7330089736 "OrthancPeers" configuration option now allows to specify HTTP headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2779
diff changeset
525 {
dc7330089736 "OrthancPeers" configuration option now allows to specify HTTP headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2779
diff changeset
526 return (!certificateFile_.empty() ||
dc7330089736 "OrthancPeers" configuration option now allows to specify HTTP headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2779
diff changeset
527 !certificateKeyFile_.empty() ||
dc7330089736 "OrthancPeers" configuration option now allows to specify HTTP headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2779
diff changeset
528 !certificateKeyPassword_.empty() ||
dc7330089736 "OrthancPeers" configuration option now allows to specify HTTP headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2779
diff changeset
529 pkcs11Enabled_ ||
2823
807169f85ba9 OrthancPluginGetPeerUserProperty()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2800
diff changeset
530 !headers_.empty() ||
4522
017ab543e6ef added field "Timeout" in "OrthancPeers" configuration option
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
531 !userProperties_.empty() ||
017ab543e6ef added field "Timeout" in "OrthancPeers" configuration option
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
532 timeout_ != 0);
2800
dc7330089736 "OrthancPeers" configuration option now allows to specify HTTP headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2779
diff changeset
533 }
dc7330089736 "OrthancPeers" configuration option now allows to specify HTTP headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2779
diff changeset
534
dc7330089736 "OrthancPeers" configuration option now allows to specify HTTP headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2779
diff changeset
535
dc7330089736 "OrthancPeers" configuration option now allows to specify HTTP headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2779
diff changeset
536 void WebServiceParameters::Serialize(Json::Value& value,
dc7330089736 "OrthancPeers" configuration option now allows to specify HTTP headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2779
diff changeset
537 bool forceAdvancedFormat,
dc7330089736 "OrthancPeers" configuration option now allows to specify HTTP headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2779
diff changeset
538 bool includePasswords) const
dc7330089736 "OrthancPeers" configuration option now allows to specify HTTP headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2779
diff changeset
539 {
dc7330089736 "OrthancPeers" configuration option now allows to specify HTTP headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2779
diff changeset
540 if (forceAdvancedFormat ||
dc7330089736 "OrthancPeers" configuration option now allows to specify HTTP headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2779
diff changeset
541 IsAdvancedFormatNeeded())
2019
9c9332e486ca HTTPS client certificates can be associated with Orthanc peers to enhance security over Internet
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
542 {
9c9332e486ca HTTPS client certificates can be associated with Orthanc peers to enhance security over Internet
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
543 value = Json::objectValue;
2800
dc7330089736 "OrthancPeers" configuration option now allows to specify HTTP headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2779
diff changeset
544 value[KEY_URL] = url_;
2019
9c9332e486ca HTTPS client certificates can be associated with Orthanc peers to enhance security over Internet
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
545
9c9332e486ca HTTPS client certificates can be associated with Orthanc peers to enhance security over Internet
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
546 if (!username_.empty() ||
9c9332e486ca HTTPS client certificates can be associated with Orthanc peers to enhance security over Internet
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
547 !password_.empty())
9c9332e486ca HTTPS client certificates can be associated with Orthanc peers to enhance security over Internet
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
548 {
2800
dc7330089736 "OrthancPeers" configuration option now allows to specify HTTP headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2779
diff changeset
549 value[KEY_USERNAME] = username_;
2669
eaf10085ffa1 no passwords in public content of jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2659
diff changeset
550
eaf10085ffa1 no passwords in public content of jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2659
diff changeset
551 if (includePasswords)
eaf10085ffa1 no passwords in public content of jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2659
diff changeset
552 {
2800
dc7330089736 "OrthancPeers" configuration option now allows to specify HTTP headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2779
diff changeset
553 value[KEY_PASSWORD] = password_;
2669
eaf10085ffa1 no passwords in public content of jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2659
diff changeset
554 }
2019
9c9332e486ca HTTPS client certificates can be associated with Orthanc peers to enhance security over Internet
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
555 }
9c9332e486ca HTTPS client certificates can be associated with Orthanc peers to enhance security over Internet
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
556
9c9332e486ca HTTPS client certificates can be associated with Orthanc peers to enhance security over Internet
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
557 if (!certificateFile_.empty())
9c9332e486ca HTTPS client certificates can be associated with Orthanc peers to enhance security over Internet
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
558 {
2800
dc7330089736 "OrthancPeers" configuration option now allows to specify HTTP headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2779
diff changeset
559 value[KEY_CERTIFICATE_FILE] = certificateFile_;
2019
9c9332e486ca HTTPS client certificates can be associated with Orthanc peers to enhance security over Internet
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
560 }
9c9332e486ca HTTPS client certificates can be associated with Orthanc peers to enhance security over Internet
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
561
9c9332e486ca HTTPS client certificates can be associated with Orthanc peers to enhance security over Internet
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
562 if (!certificateKeyFile_.empty())
9c9332e486ca HTTPS client certificates can be associated with Orthanc peers to enhance security over Internet
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
563 {
2800
dc7330089736 "OrthancPeers" configuration option now allows to specify HTTP headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2779
diff changeset
564 value[KEY_CERTIFICATE_KEY_FILE] = certificateKeyFile_;
2019
9c9332e486ca HTTPS client certificates can be associated with Orthanc peers to enhance security over Internet
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
565 }
9c9332e486ca HTTPS client certificates can be associated with Orthanc peers to enhance security over Internet
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
566
2669
eaf10085ffa1 no passwords in public content of jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2659
diff changeset
567 if (!certificateKeyPassword_.empty() &&
eaf10085ffa1 no passwords in public content of jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2659
diff changeset
568 includePasswords)
2019
9c9332e486ca HTTPS client certificates can be associated with Orthanc peers to enhance security over Internet
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
569 {
2800
dc7330089736 "OrthancPeers" configuration option now allows to specify HTTP headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2779
diff changeset
570 value[KEY_CERTIFICATE_KEY_PASSWORD] = certificateKeyPassword_;
dc7330089736 "OrthancPeers" configuration option now allows to specify HTTP headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2779
diff changeset
571 }
dc7330089736 "OrthancPeers" configuration option now allows to specify HTTP headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2779
diff changeset
572
dc7330089736 "OrthancPeers" configuration option now allows to specify HTTP headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2779
diff changeset
573 value[KEY_PKCS11] = pkcs11Enabled_;
4522
017ab543e6ef added field "Timeout" in "OrthancPeers" configuration option
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
574 value[KEY_TIMEOUT] = timeout_;
2800
dc7330089736 "OrthancPeers" configuration option now allows to specify HTTP headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2779
diff changeset
575
dc7330089736 "OrthancPeers" configuration option now allows to specify HTTP headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2779
diff changeset
576 value[KEY_HTTP_HEADERS] = Json::objectValue;
2823
807169f85ba9 OrthancPluginGetPeerUserProperty()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2800
diff changeset
577 for (Dictionary::const_iterator it = headers_.begin();
2800
dc7330089736 "OrthancPeers" configuration option now allows to specify HTTP headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2779
diff changeset
578 it != headers_.end(); ++it)
dc7330089736 "OrthancPeers" configuration option now allows to specify HTTP headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2779
diff changeset
579 {
dc7330089736 "OrthancPeers" configuration option now allows to specify HTTP headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2779
diff changeset
580 value[KEY_HTTP_HEADERS][it->first] = it->second;
2019
9c9332e486ca HTTPS client certificates can be associated with Orthanc peers to enhance security over Internet
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
581 }
2823
807169f85ba9 OrthancPluginGetPeerUserProperty()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2800
diff changeset
582
807169f85ba9 OrthancPluginGetPeerUserProperty()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2800
diff changeset
583 for (Dictionary::const_iterator it = userProperties_.begin();
807169f85ba9 OrthancPluginGetPeerUserProperty()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2800
diff changeset
584 it != userProperties_.end(); ++it)
807169f85ba9 OrthancPluginGetPeerUserProperty()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2800
diff changeset
585 {
807169f85ba9 OrthancPluginGetPeerUserProperty()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2800
diff changeset
586 value[it->first] = it->second;
807169f85ba9 OrthancPluginGetPeerUserProperty()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2800
diff changeset
587 }
2019
9c9332e486ca HTTPS client certificates can be associated with Orthanc peers to enhance security over Internet
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
588 }
9c9332e486ca HTTPS client certificates can be associated with Orthanc peers to enhance security over Internet
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
589 else
9c9332e486ca HTTPS client certificates can be associated with Orthanc peers to enhance security over Internet
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
590 {
9c9332e486ca HTTPS client certificates can be associated with Orthanc peers to enhance security over Internet
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
591 value = Json::arrayValue;
9c9332e486ca HTTPS client certificates can be associated with Orthanc peers to enhance security over Internet
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
592 value.append(url_);
9c9332e486ca HTTPS client certificates can be associated with Orthanc peers to enhance security over Internet
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
593
9c9332e486ca HTTPS client certificates can be associated with Orthanc peers to enhance security over Internet
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
594 if (!username_.empty() ||
9c9332e486ca HTTPS client certificates can be associated with Orthanc peers to enhance security over Internet
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
595 !password_.empty())
9c9332e486ca HTTPS client certificates can be associated with Orthanc peers to enhance security over Internet
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
596 {
9c9332e486ca HTTPS client certificates can be associated with Orthanc peers to enhance security over Internet
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
597 value.append(username_);
2800
dc7330089736 "OrthancPeers" configuration option now allows to specify HTTP headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2779
diff changeset
598 value.append(includePasswords ? password_ : "");
2019
9c9332e486ca HTTPS client certificates can be associated with Orthanc peers to enhance security over Internet
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
599 }
9c9332e486ca HTTPS client certificates can be associated with Orthanc peers to enhance security over Internet
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
600 }
9c9332e486ca HTTPS client certificates can be associated with Orthanc peers to enhance security over Internet
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
601 }
2655
c196d76cb8fa serialization
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2447
diff changeset
602
c196d76cb8fa serialization
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2447
diff changeset
603
2779
d67298eec14e fix sandboxing
am@osimis.io
parents: 2669
diff changeset
604 #if ORTHANC_SANDBOXED == 0
2800
dc7330089736 "OrthancPeers" configuration option now allows to specify HTTP headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2779
diff changeset
605 void WebServiceParameters::CheckClientCertificate() const
2655
c196d76cb8fa serialization
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2447
diff changeset
606 {
2800
dc7330089736 "OrthancPeers" configuration option now allows to specify HTTP headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2779
diff changeset
607 if (!certificateFile_.empty())
dc7330089736 "OrthancPeers" configuration option now allows to specify HTTP headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2779
diff changeset
608 {
dc7330089736 "OrthancPeers" configuration option now allows to specify HTTP headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2779
diff changeset
609 if (!SystemToolbox::IsRegularFile(certificateFile_))
dc7330089736 "OrthancPeers" configuration option now allows to specify HTTP headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2779
diff changeset
610 {
2954
d924f9bb61cc taking advantage of details in OrthancException
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2823
diff changeset
611 throw OrthancException(ErrorCode_InexistentFile,
d924f9bb61cc taking advantage of details in OrthancException
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2823
diff changeset
612 "Cannot open certificate file: " + certificateFile_);
2800
dc7330089736 "OrthancPeers" configuration option now allows to specify HTTP headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2779
diff changeset
613 }
2659
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2655
diff changeset
614
2800
dc7330089736 "OrthancPeers" configuration option now allows to specify HTTP headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2779
diff changeset
615 if (!certificateKeyFile_.empty() &&
dc7330089736 "OrthancPeers" configuration option now allows to specify HTTP headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2779
diff changeset
616 !SystemToolbox::IsRegularFile(certificateKeyFile_))
dc7330089736 "OrthancPeers" configuration option now allows to specify HTTP headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2779
diff changeset
617 {
2954
d924f9bb61cc taking advantage of details in OrthancException
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2823
diff changeset
618 throw OrthancException(ErrorCode_InexistentFile,
d924f9bb61cc taking advantage of details in OrthancException
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2823
diff changeset
619 "Cannot open key file: " + certificateKeyFile_);
2800
dc7330089736 "OrthancPeers" configuration option now allows to specify HTTP headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2779
diff changeset
620 }
2659
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2655
diff changeset
621 }
2655
c196d76cb8fa serialization
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2447
diff changeset
622 }
2779
d67298eec14e fix sandboxing
am@osimis.io
parents: 2669
diff changeset
623 #endif
3192
595bfee4391a URI "/peers?expand" provides more information
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3060
diff changeset
624
595bfee4391a URI "/peers?expand" provides more information
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3060
diff changeset
625
595bfee4391a URI "/peers?expand" provides more information
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3060
diff changeset
626 void WebServiceParameters::FormatPublic(Json::Value& target) const
595bfee4391a URI "/peers?expand" provides more information
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3060
diff changeset
627 {
595bfee4391a URI "/peers?expand" provides more information
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3060
diff changeset
628 target = Json::objectValue;
595bfee4391a URI "/peers?expand" provides more information
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3060
diff changeset
629
595bfee4391a URI "/peers?expand" provides more information
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3060
diff changeset
630 // Only return the public information identifying the destination.
595bfee4391a URI "/peers?expand" provides more information
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3060
diff changeset
631 // "Security"-related information such as passwords and HTTP
595bfee4391a URI "/peers?expand" provides more information
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3060
diff changeset
632 // headers are shown as "null" values.
595bfee4391a URI "/peers?expand" provides more information
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3060
diff changeset
633 target[KEY_URL] = url_;
595bfee4391a URI "/peers?expand" provides more information
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3060
diff changeset
634
595bfee4391a URI "/peers?expand" provides more information
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3060
diff changeset
635 if (!username_.empty())
595bfee4391a URI "/peers?expand" provides more information
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3060
diff changeset
636 {
595bfee4391a URI "/peers?expand" provides more information
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3060
diff changeset
637 target[KEY_USERNAME] = username_;
595bfee4391a URI "/peers?expand" provides more information
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3060
diff changeset
638 target[KEY_PASSWORD] = Json::nullValue;
595bfee4391a URI "/peers?expand" provides more information
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3060
diff changeset
639 }
595bfee4391a URI "/peers?expand" provides more information
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3060
diff changeset
640
595bfee4391a URI "/peers?expand" provides more information
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3060
diff changeset
641 if (!certificateFile_.empty())
595bfee4391a URI "/peers?expand" provides more information
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3060
diff changeset
642 {
595bfee4391a URI "/peers?expand" provides more information
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3060
diff changeset
643 target[KEY_CERTIFICATE_FILE] = certificateFile_;
595bfee4391a URI "/peers?expand" provides more information
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3060
diff changeset
644 target[KEY_CERTIFICATE_KEY_FILE] = Json::nullValue;
595bfee4391a URI "/peers?expand" provides more information
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3060
diff changeset
645 target[KEY_CERTIFICATE_KEY_PASSWORD] = Json::nullValue;
595bfee4391a URI "/peers?expand" provides more information
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3060
diff changeset
646 }
595bfee4391a URI "/peers?expand" provides more information
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3060
diff changeset
647
595bfee4391a URI "/peers?expand" provides more information
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3060
diff changeset
648 target[KEY_PKCS11] = pkcs11Enabled_;
4522
017ab543e6ef added field "Timeout" in "OrthancPeers" configuration option
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
649 target[KEY_TIMEOUT] = timeout_;
3192
595bfee4391a URI "/peers?expand" provides more information
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3060
diff changeset
650
595bfee4391a URI "/peers?expand" provides more information
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3060
diff changeset
651 Json::Value headers = Json::arrayValue;
595bfee4391a URI "/peers?expand" provides more information
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3060
diff changeset
652
595bfee4391a URI "/peers?expand" provides more information
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3060
diff changeset
653 for (Dictionary::const_iterator it = headers_.begin();
595bfee4391a URI "/peers?expand" provides more information
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3060
diff changeset
654 it != headers_.end(); ++it)
595bfee4391a URI "/peers?expand" provides more information
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3060
diff changeset
655 {
595bfee4391a URI "/peers?expand" provides more information
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3060
diff changeset
656 // Only list the HTTP headers, not their value
595bfee4391a URI "/peers?expand" provides more information
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3060
diff changeset
657 headers.append(it->first);
595bfee4391a URI "/peers?expand" provides more information
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3060
diff changeset
658 }
595bfee4391a URI "/peers?expand" provides more information
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3060
diff changeset
659
595bfee4391a URI "/peers?expand" provides more information
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3060
diff changeset
660 target[KEY_HTTP_HEADERS] = headers;
595bfee4391a URI "/peers?expand" provides more information
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3060
diff changeset
661
595bfee4391a URI "/peers?expand" provides more information
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3060
diff changeset
662 for (Dictionary::const_iterator it = userProperties_.begin();
595bfee4391a URI "/peers?expand" provides more information
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3060
diff changeset
663 it != userProperties_.end(); ++it)
595bfee4391a URI "/peers?expand" provides more information
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3060
diff changeset
664 {
595bfee4391a URI "/peers?expand" provides more information
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3060
diff changeset
665 target[it->first] = it->second;
595bfee4391a URI "/peers?expand" provides more information
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3060
diff changeset
666 }
595bfee4391a URI "/peers?expand" provides more information
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3060
diff changeset
667 }
4522
017ab543e6ef added field "Timeout" in "OrthancPeers" configuration option
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
668
017ab543e6ef added field "Timeout" in "OrthancPeers" configuration option
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
669
017ab543e6ef added field "Timeout" in "OrthancPeers" configuration option
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
670 void WebServiceParameters::SetTimeout(uint32_t seconds)
017ab543e6ef added field "Timeout" in "OrthancPeers" configuration option
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
671 {
017ab543e6ef added field "Timeout" in "OrthancPeers" configuration option
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
672 timeout_ = seconds;
017ab543e6ef added field "Timeout" in "OrthancPeers" configuration option
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
673 }
017ab543e6ef added field "Timeout" in "OrthancPeers" configuration option
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
674
017ab543e6ef added field "Timeout" in "OrthancPeers" configuration option
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
675 uint32_t WebServiceParameters::GetTimeout() const
017ab543e6ef added field "Timeout" in "OrthancPeers" configuration option
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
676 {
017ab543e6ef added field "Timeout" in "OrthancPeers" configuration option
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
677 return timeout_;
017ab543e6ef added field "Timeout" in "OrthancPeers" configuration option
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
678 }
017ab543e6ef added field "Timeout" in "OrthancPeers" configuration option
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
679
017ab543e6ef added field "Timeout" in "OrthancPeers" configuration option
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
680 bool WebServiceParameters::HasTimeout() const
017ab543e6ef added field "Timeout" in "OrthancPeers" configuration option
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
681 {
017ab543e6ef added field "Timeout" in "OrthancPeers" configuration option
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
682 return (timeout_ != 0);
017ab543e6ef added field "Timeout" in "OrthancPeers" configuration option
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
683 }
808
2d9a000aa3a6 update/delete peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
684 }