Mercurial > hg > orthanc
annotate Core/WebServiceParameters.cpp @ 2690:e0d600882ed2 jobs
fix
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Thu, 28 Jun 2018 16:07:57 +0200 |
parents | eaf10085ffa1 |
children | d67298eec14e |
rev | line source |
---|---|
808 | 1 /** |
2 * Orthanc - A Lightweight, RESTful DICOM Store | |
1900 | 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 |
2447
878b59270859
upgrade to year 2018
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2244
diff
changeset
|
5 * Copyright (C) 2017-2018 Osimis S.A., Belgium |
808 | 6 * |
7 * This program is free software: you can redistribute it and/or | |
8 * modify it under the terms of the GNU General Public License as | |
9 * published by the Free Software Foundation, either version 3 of the | |
10 * License, or (at your option) any later version. | |
11 * | |
12 * In addition, as a special exception, the copyright holders of this | |
13 * program give permission to link the code of its release with the | |
14 * OpenSSL project's "OpenSSL" library (or with modified versions of it | |
15 * that use the same license as the "OpenSSL" library), and distribute | |
16 * the linked executables. You must obey the GNU General Public License | |
17 * in all respects for all of the code used other than "OpenSSL". If you | |
18 * modify file(s) with this exception, you may extend this exception to | |
19 * your version of the file(s), but you are not obligated to do so. If | |
20 * you do not wish to do so, delete this exception statement from your | |
21 * version. If you delete this exception statement from all source files | |
22 * in the program, then also delete it here. | |
23 * | |
24 * This program is distributed in the hope that it will be useful, but | |
25 * WITHOUT ANY WARRANTY; without even the implied warranty of | |
26 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
27 * General Public License for more details. | |
28 * | |
29 * You should have received a copy of the GNU General Public License | |
30 * along with this program. If not, see <http://www.gnu.org/licenses/>. | |
31 **/ | |
32 | |
33 | |
2020 | 34 #include "PrecompiledHeaders.h" |
35 #include "WebServiceParameters.h" | |
808 | 36 |
2659 | 37 #include "Logging.h" |
38 #include "OrthancException.h" | |
39 #include "SerializationToolbox.h" | |
808 | 40 |
2145 | 41 #if ORTHANC_SANDBOXED == 0 |
42 # include "../Core/SystemToolbox.h" | |
43 #endif | |
44 | |
2021 | 45 #include <cassert> |
46 | |
808 | 47 namespace Orthanc |
48 { | |
2020 | 49 WebServiceParameters::WebServiceParameters() : |
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
|
50 advancedFormat_(false), |
2032
65b1ce7cb84f
Replaced "localhost" by "127.0.0.1", as it might impact performance on Windows
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2022
diff
changeset
|
51 url_("http://127.0.0.1:8042/"), |
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
|
52 pkcs11Enabled_(false) |
808 | 53 { |
54 } | |
55 | |
56 | |
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
|
57 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
|
58 { |
fefbe71c2272
Possibility to use PKCS#11 authentication for hardware security modules with Orthanc peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2021
diff
changeset
|
59 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
|
60 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
|
61 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
|
62 } |
fefbe71c2272
Possibility to use PKCS#11 authentication for hardware security modules with Orthanc peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2021
diff
changeset
|
63 |
fefbe71c2272
Possibility to use PKCS#11 authentication for hardware security modules with Orthanc peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2021
diff
changeset
|
64 |
2145 | 65 #if ORTHANC_SANDBOXED == 0 |
2020 | 66 void WebServiceParameters::SetClientCertificate(const std::string& certificateFile, |
67 const std::string& certificateKeyFile, | |
68 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
|
69 { |
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
|
70 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
|
71 { |
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
|
72 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
|
73 } |
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
|
74 |
2140 | 75 if (!SystemToolbox::IsRegularFile(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
|
76 { |
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
|
77 LOG(ERROR) << "Cannot open certificate file: " << 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
|
78 throw OrthancException(ErrorCode_InexistentFile); |
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
|
79 } |
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
|
80 |
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
|
81 if (!certificateKeyFile.empty() && |
2140 | 82 !SystemToolbox::IsRegularFile(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
|
83 { |
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
|
84 LOG(ERROR) << "Cannot open key file: " << 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
|
85 throw OrthancException(ErrorCode_InexistentFile); |
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
|
86 } |
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
|
87 |
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
|
88 advancedFormat_ = true; |
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
|
89 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
|
90 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
|
91 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
|
92 } |
2145 | 93 #endif |
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
|
94 |
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
|
95 |
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
|
96 static void AddTrailingSlash(std::string& 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
|
97 { |
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
|
98 if (url.size() != 0 && |
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
|
99 url[url.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
|
100 { |
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
|
101 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
|
102 } |
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
|
103 } |
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
|
104 |
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
|
105 |
2020 | 106 void WebServiceParameters::FromJsonArray(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
|
107 { |
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
|
108 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
|
109 |
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
|
110 advancedFormat_ = false; |
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
|
111 pkcs11Enabled_ = false; |
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
|
112 |
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
|
113 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
|
114 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
|
115 { |
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
|
116 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
|
117 } |
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
|
118 |
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
|
119 std::string url = peer.get(0u, "").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
|
120 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
|
121 { |
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
|
122 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
|
123 } |
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
|
124 |
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
|
125 AddTrailingSlash(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
|
126 SetUrl(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
|
127 |
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
|
128 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
|
129 { |
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
|
130 SetUsername(""); |
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
|
131 SetPassword(""); |
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
|
132 } |
2669
eaf10085ffa1
no passwords in public content of jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2659
diff
changeset
|
133 else if (peer.size() == 2) |
eaf10085ffa1
no passwords in public content of jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2659
diff
changeset
|
134 { |
eaf10085ffa1
no passwords in public content of jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2659
diff
changeset
|
135 LOG(ERROR) << "The HTTP password is not provided"; |
eaf10085ffa1
no passwords in public content of jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2659
diff
changeset
|
136 throw OrthancException(ErrorCode_BadFileFormat); |
eaf10085ffa1
no passwords in public content of jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2659
diff
changeset
|
137 } |
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
|
138 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
|
139 { |
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
|
140 SetUsername(peer.get(1u, "").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
|
141 SetPassword(peer.get(2u, "").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
|
142 } |
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
|
143 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
|
144 { |
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
|
145 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
|
146 } |
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
|
147 } |
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
|
148 |
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
|
149 |
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
|
150 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
|
151 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
|
152 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
|
153 { |
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
|
154 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
|
155 { |
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
|
156 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
|
157 } |
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
|
158 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
|
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 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
|
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 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
|
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 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
|
165 } |
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 } |
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
|
167 |
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 |
2020 | 169 void WebServiceParameters::FromJsonObject(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
|
170 { |
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 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
|
172 advancedFormat_ = true; |
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 std::string url = GetStringMember(peer, "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
|
175 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
|
176 { |
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
|
177 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
|
178 } |
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
|
179 |
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
|
180 AddTrailingSlash(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
|
181 SetUrl(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
|
182 |
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
|
183 SetUsername(GetStringMember(peer, "Username", "")); |
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
|
184 SetPassword(GetStringMember(peer, "Password", "")); |
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
|
185 |
2669
eaf10085ffa1
no passwords in public content of jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2659
diff
changeset
|
186 if (!username_.empty() && |
eaf10085ffa1
no passwords in public content of jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2659
diff
changeset
|
187 !peer.isMember("Password")) |
eaf10085ffa1
no passwords in public content of jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2659
diff
changeset
|
188 { |
eaf10085ffa1
no passwords in public content of jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2659
diff
changeset
|
189 LOG(ERROR) << "The HTTP password is not provided"; |
eaf10085ffa1
no passwords in public content of jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2659
diff
changeset
|
190 throw OrthancException(ErrorCode_BadFileFormat); |
eaf10085ffa1
no passwords in public content of jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2659
diff
changeset
|
191 } |
eaf10085ffa1
no passwords in public content of jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2659
diff
changeset
|
192 |
2146 | 193 #if ORTHANC_SANDBOXED == 0 |
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
|
194 if (peer.isMember("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
|
195 { |
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
|
196 SetClientCertificate(GetStringMember(peer, "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
|
197 GetStringMember(peer, "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
|
198 GetStringMember(peer, "CertificateKeyPassword", "")); |
2669
eaf10085ffa1
no passwords in public content of jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2659
diff
changeset
|
199 |
eaf10085ffa1
no passwords in public content of jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2659
diff
changeset
|
200 if (!peer.isMember("CertificateKeyPassword")) |
eaf10085ffa1
no passwords in public content of jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2659
diff
changeset
|
201 { |
eaf10085ffa1
no passwords in public content of jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2659
diff
changeset
|
202 LOG(ERROR) << "The password for the HTTPS certificate is not provided"; |
eaf10085ffa1
no passwords in public content of jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2659
diff
changeset
|
203 throw OrthancException(ErrorCode_BadFileFormat); |
eaf10085ffa1
no passwords in public content of jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2659
diff
changeset
|
204 } |
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
|
205 } |
2146 | 206 #endif |
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
|
207 |
fefbe71c2272
Possibility to use PKCS#11 authentication for hardware security modules with Orthanc peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2021
diff
changeset
|
208 if (peer.isMember("Pkcs11")) |
fefbe71c2272
Possibility to use PKCS#11 authentication for hardware security modules with Orthanc peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2021
diff
changeset
|
209 { |
fefbe71c2272
Possibility to use PKCS#11 authentication for hardware security modules with Orthanc peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2021
diff
changeset
|
210 if (peer["Pkcs11"].type() == Json::booleanValue) |
fefbe71c2272
Possibility to use PKCS#11 authentication for hardware security modules with Orthanc peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2021
diff
changeset
|
211 { |
fefbe71c2272
Possibility to use PKCS#11 authentication for hardware security modules with Orthanc peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2021
diff
changeset
|
212 pkcs11Enabled_ = peer["Pkcs11"].asBool(); |
fefbe71c2272
Possibility to use PKCS#11 authentication for hardware security modules with Orthanc peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2021
diff
changeset
|
213 } |
fefbe71c2272
Possibility to use PKCS#11 authentication for hardware security modules with Orthanc peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2021
diff
changeset
|
214 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
|
215 { |
fefbe71c2272
Possibility to use PKCS#11 authentication for hardware security modules with Orthanc peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2021
diff
changeset
|
216 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
|
217 } |
fefbe71c2272
Possibility to use PKCS#11 authentication for hardware security modules with Orthanc peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2021
diff
changeset
|
218 } |
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
|
219 } |
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
|
220 |
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
|
221 |
2020 | 222 void WebServiceParameters::FromJson(const Json::Value& peer) |
808 | 223 { |
224 try | |
225 { | |
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
|
226 if (peer.isArray()) |
808 | 227 { |
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
|
228 FromJsonArray(peer); |
808 | 229 } |
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
|
230 else if (peer.isObject()) |
808 | 231 { |
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
|
232 FromJsonObject(peer); |
808 | 233 } |
234 else | |
235 { | |
236 throw OrthancException(ErrorCode_BadFileFormat); | |
237 } | |
238 } | |
2042 | 239 catch (OrthancException&) |
240 { | |
241 throw; | |
242 } | |
808 | 243 catch (...) |
244 { | |
245 throw OrthancException(ErrorCode_BadFileFormat); | |
246 } | |
247 } | |
248 | |
249 | |
2669
eaf10085ffa1
no passwords in public content of jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2659
diff
changeset
|
250 void WebServiceParameters::ToJson(Json::Value& value, |
eaf10085ffa1
no passwords in public content of jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2659
diff
changeset
|
251 bool includePasswords) const |
808 | 252 { |
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
|
253 if (advancedFormat_) |
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 { |
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 value = Json::objectValue; |
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 value["Url"] = 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
|
257 |
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 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
|
259 !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
|
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 value["Username"] = username_; |
2669
eaf10085ffa1
no passwords in public content of jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2659
diff
changeset
|
262 |
eaf10085ffa1
no passwords in public content of jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2659
diff
changeset
|
263 if (includePasswords) |
eaf10085ffa1
no passwords in public content of jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2659
diff
changeset
|
264 { |
eaf10085ffa1
no passwords in public content of jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2659
diff
changeset
|
265 value["Password"] = password_; |
eaf10085ffa1
no passwords in public content of jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2659
diff
changeset
|
266 } |
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
|
267 } |
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 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
|
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 value["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
|
272 } |
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 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
|
275 { |
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
|
276 value["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
|
277 } |
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 |
2669
eaf10085ffa1
no passwords in public content of jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2659
diff
changeset
|
279 if (!certificateKeyPassword_.empty() && |
eaf10085ffa1
no passwords in public content of jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2659
diff
changeset
|
280 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
|
281 { |
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
|
282 value["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
|
283 } |
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 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
|
286 { |
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
|
287 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
|
288 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
|
289 |
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
|
290 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
|
291 !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
|
292 { |
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
|
293 value.append(username_); |
2669
eaf10085ffa1
no passwords in public content of jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2659
diff
changeset
|
294 |
eaf10085ffa1
no passwords in public content of jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2659
diff
changeset
|
295 if (includePasswords) |
eaf10085ffa1
no passwords in public content of jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2659
diff
changeset
|
296 { |
eaf10085ffa1
no passwords in public content of jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2659
diff
changeset
|
297 value.append(password_); |
eaf10085ffa1
no passwords in public content of jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2659
diff
changeset
|
298 } |
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
|
299 } |
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
|
300 } |
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 } |
2655 | 302 |
303 | |
304 void WebServiceParameters::Serialize(Json::Value& target) const | |
305 { | |
2659 | 306 target = Json::objectValue; |
307 target["URL"] = url_; | |
308 target["Username"] = username_; | |
309 target["Password"] = password_; | |
310 target["CertificateFile"] = certificateFile_; | |
311 target["CertificateKeyFile"] = certificateKeyFile_; | |
312 target["CertificateKeyPassword"] = certificateKeyPassword_; | |
313 target["PKCS11"] = pkcs11Enabled_; | |
2669
eaf10085ffa1
no passwords in public content of jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2659
diff
changeset
|
314 target["AdvancedFormat"] = advancedFormat_; |
2655 | 315 } |
316 | |
317 | |
2659 | 318 WebServiceParameters::WebServiceParameters(const Json::Value& serialized) : |
319 advancedFormat_(true) | |
2655 | 320 { |
2659 | 321 url_ = SerializationToolbox::ReadString(serialized, "URL"); |
322 username_ = SerializationToolbox::ReadString(serialized, "Username"); | |
323 password_ = SerializationToolbox::ReadString(serialized, "Password"); | |
324 | |
325 std::string a, b, c; | |
326 a = SerializationToolbox::ReadString(serialized, "CertificateFile"); | |
327 b = SerializationToolbox::ReadString(serialized, "CertificateKeyFile"); | |
328 c = SerializationToolbox::ReadString(serialized, "CertificateKeyPassword"); | |
329 | |
330 if (!a.empty()) | |
331 { | |
332 SetClientCertificate(a, b, c); | |
333 } | |
334 | |
335 pkcs11Enabled_ = SerializationToolbox::ReadBoolean(serialized, "PKCS11"); | |
2669
eaf10085ffa1
no passwords in public content of jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2659
diff
changeset
|
336 advancedFormat_ = SerializationToolbox::ReadBoolean(serialized, "AdvancedFormat"); |
2655 | 337 } |
808 | 338 } |