annotate Core/WebServiceParameters.cpp @ 2143:fd5875662670

creation of namespace SystemToolbox
author Sebastien Jodogne <s.jodogne@gmail.com>
date Wed, 09 Nov 2016 16:54:23 +0100
parents aa4b8895cd23
children 39f4207727db
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
808
2d9a000aa3a6 update/delete peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5 *
2d9a000aa3a6 update/delete peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6 * This program is free software: you can redistribute it and/or
2d9a000aa3a6 update/delete peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7 * modify it under the terms of the GNU General Public License as
2d9a000aa3a6 update/delete peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8 * published by the Free Software Foundation, either version 3 of the
2d9a000aa3a6 update/delete peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9 * License, or (at your option) any later version.
2d9a000aa3a6 update/delete peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
10 *
2d9a000aa3a6 update/delete peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
11 * In addition, as a special exception, the copyright holders of this
2d9a000aa3a6 update/delete peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
12 * program give permission to link the code of its release with the
2d9a000aa3a6 update/delete peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
13 * OpenSSL project's "OpenSSL" library (or with modified versions of it
2d9a000aa3a6 update/delete peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
14 * that use the same license as the "OpenSSL" library), and distribute
2d9a000aa3a6 update/delete peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
15 * the linked executables. You must obey the GNU General Public License
2d9a000aa3a6 update/delete peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
16 * in all respects for all of the code used other than "OpenSSL". If you
2d9a000aa3a6 update/delete peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
17 * modify file(s) with this exception, you may extend this exception to
2d9a000aa3a6 update/delete peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
18 * your version of the file(s), but you are not obligated to do so. If
2d9a000aa3a6 update/delete peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
19 * you do not wish to do so, delete this exception statement from your
2d9a000aa3a6 update/delete peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
20 * version. If you delete this exception statement from all source files
2d9a000aa3a6 update/delete peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
21 * in the program, then also delete it here.
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 * 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
24 * WITHOUT ANY WARRANTY; without even the implied warranty of
2d9a000aa3a6 update/delete peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
25 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
2d9a000aa3a6 update/delete peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
26 * General Public License for more details.
2d9a000aa3a6 update/delete peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
27 *
2d9a000aa3a6 update/delete peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
28 * You should have received a copy of the GNU General Public License
2d9a000aa3a6 update/delete peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
29 * along with this program. If not, see <http://www.gnu.org/licenses/>.
2d9a000aa3a6 update/delete peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
30 **/
2d9a000aa3a6 update/delete peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
31
2d9a000aa3a6 update/delete peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
32
2020
a0bd8cd55da7 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2019
diff changeset
33 #include "PrecompiledHeaders.h"
a0bd8cd55da7 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2019
diff changeset
34 #include "WebServiceParameters.h"
808
2d9a000aa3a6 update/delete peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
35
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
36 #include "../Core/Logging.h"
2143
fd5875662670 creation of namespace SystemToolbox
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2140
diff changeset
37 #include "../Core/SystemToolbox.h"
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
38 #include "../Core/Toolbox.h"
808
2d9a000aa3a6 update/delete peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
39 #include "../Core/OrthancException.h"
2d9a000aa3a6 update/delete peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
40
2021
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2020
diff changeset
41 #include <cassert>
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2020
diff changeset
42
808
2d9a000aa3a6 update/delete peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
43 namespace Orthanc
2d9a000aa3a6 update/delete peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
44 {
2020
a0bd8cd55da7 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2019
diff changeset
45 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
46 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
47 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
48 pkcs11Enabled_(false)
808
2d9a000aa3a6 update/delete peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
49 {
2d9a000aa3a6 update/delete peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
50 }
2d9a000aa3a6 update/delete peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
51
2d9a000aa3a6 update/delete peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
52
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
53 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
54 {
fefbe71c2272 Possibility to use PKCS#11 authentication for hardware security modules with Orthanc peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2021
diff changeset
55 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
56 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
57 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
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
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
2020
a0bd8cd55da7 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2019
diff changeset
61 void WebServiceParameters::SetClientCertificate(const std::string& certificateFile,
a0bd8cd55da7 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2019
diff changeset
62 const std::string& certificateKeyFile,
a0bd8cd55da7 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2019
diff changeset
63 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
64 {
9c9332e486ca HTTPS client certificates can be associated with Orthanc peers to enhance security over Internet
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
65 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
66 {
9c9332e486ca HTTPS client certificates can be associated with Orthanc peers to enhance security over Internet
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
67 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
68 }
9c9332e486ca 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
2140
aa4b8895cd23 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2042
diff changeset
70 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
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 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
73 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
74 }
9c9332e486ca HTTPS client certificates can be associated with Orthanc peers to enhance security over Internet
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
75
9c9332e486ca 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 if (!certificateKeyFile.empty() &&
2140
aa4b8895cd23 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2042
diff changeset
77 !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
78 {
9c9332e486ca 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 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
80 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
81 }
9c9332e486ca HTTPS client certificates can be associated with Orthanc peers to enhance security over Internet
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
82
9c9332e486ca 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 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
84 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
85 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
86 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
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
9c9332e486ca 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
9c9332e486ca 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 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
91 {
9c9332e486ca 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 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
93 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
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 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
96 }
9c9332e486ca 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
9c9332e486ca 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
2020
a0bd8cd55da7 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2019
diff changeset
100 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
101 {
9c9332e486ca 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 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
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 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
105 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
106
9c9332e486ca 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 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
108 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
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 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
111 }
9c9332e486ca 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 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
114 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
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 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
120 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
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 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
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 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
125 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
126 }
9c9332e486ca 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 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
128 {
9c9332e486ca 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 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
130 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
131 }
9c9332e486ca 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 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
133 {
9c9332e486ca HTTPS client certificates can be associated with Orthanc peers to enhance security over Internet
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
134 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
135 }
9c9332e486ca HTTPS client certificates can be associated with Orthanc peers to enhance security over Internet
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
136 }
9c9332e486ca HTTPS client certificates can be associated with Orthanc peers to enhance security over Internet
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
137
9c9332e486ca 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
9c9332e486ca 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 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
140 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
141 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
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 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
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 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
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 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
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 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
150 }
9c9332e486ca 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 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
152 {
9c9332e486ca 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 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
154 }
9c9332e486ca 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
9c9332e486ca 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
2020
a0bd8cd55da7 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2019
diff changeset
158 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
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 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
161 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
162
9c9332e486ca 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 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
164 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
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 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
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
9c9332e486ca 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 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
170 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
171
9c9332e486ca 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 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
173 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
174
9c9332e486ca 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 (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
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 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
178 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
179 GetStringMember(peer, "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
180 }
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
181
fefbe71c2272 Possibility to use PKCS#11 authentication for hardware security modules with Orthanc peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2021
diff changeset
182 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
183 {
fefbe71c2272 Possibility to use PKCS#11 authentication for hardware security modules with Orthanc peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2021
diff changeset
184 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
185 {
fefbe71c2272 Possibility to use PKCS#11 authentication for hardware security modules with Orthanc peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2021
diff changeset
186 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
187 }
fefbe71c2272 Possibility to use PKCS#11 authentication for hardware security modules with Orthanc peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2021
diff changeset
188 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
189 {
fefbe71c2272 Possibility to use PKCS#11 authentication for hardware security modules with Orthanc peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2021
diff changeset
190 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
191 }
fefbe71c2272 Possibility to use PKCS#11 authentication for hardware security modules with Orthanc peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2021
diff changeset
192 }
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
193 }
9c9332e486ca 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
9c9332e486ca 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
2020
a0bd8cd55da7 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2019
diff changeset
196 void WebServiceParameters::FromJson(const Json::Value& peer)
808
2d9a000aa3a6 update/delete peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
197 {
2d9a000aa3a6 update/delete peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
198 try
2d9a000aa3a6 update/delete peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
199 {
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
200 if (peer.isArray())
808
2d9a000aa3a6 update/delete peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
201 {
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
202 FromJsonArray(peer);
808
2d9a000aa3a6 update/delete peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
203 }
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
204 else if (peer.isObject())
808
2d9a000aa3a6 update/delete peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
205 {
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
206 FromJsonObject(peer);
808
2d9a000aa3a6 update/delete peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
207 }
2d9a000aa3a6 update/delete peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
208 else
2d9a000aa3a6 update/delete peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
209 {
2d9a000aa3a6 update/delete peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
210 throw OrthancException(ErrorCode_BadFileFormat);
2d9a000aa3a6 update/delete peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
211 }
2d9a000aa3a6 update/delete peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
212 }
2042
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2032
diff changeset
213 catch (OrthancException&)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2032
diff changeset
214 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2032
diff changeset
215 throw;
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2032
diff changeset
216 }
808
2d9a000aa3a6 update/delete peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
217 catch (...)
2d9a000aa3a6 update/delete peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
218 {
2d9a000aa3a6 update/delete peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
219 throw OrthancException(ErrorCode_BadFileFormat);
2d9a000aa3a6 update/delete peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
220 }
2d9a000aa3a6 update/delete peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
221 }
2d9a000aa3a6 update/delete peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
222
2d9a000aa3a6 update/delete peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
223
2020
a0bd8cd55da7 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2019
diff changeset
224 void WebServiceParameters::ToJson(Json::Value& value) const
808
2d9a000aa3a6 update/delete peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
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 (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
227 {
9c9332e486ca 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 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
229 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
230
9c9332e486ca 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 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
232 !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
233 {
9c9332e486ca HTTPS client certificates can be associated with Orthanc peers to enhance security over Internet
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
234 value["Username"] = 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
235 value["Password"] = 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
236 }
9c9332e486ca HTTPS client certificates can be associated with Orthanc peers to enhance security over Internet
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
237
9c9332e486ca HTTPS client certificates can be associated with Orthanc peers to enhance security over Internet
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
238 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
239 {
9c9332e486ca HTTPS client certificates can be associated with Orthanc peers to enhance security over Internet
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
240 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
241 }
9c9332e486ca 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
9c9332e486ca HTTPS client certificates can be associated with Orthanc peers to enhance security over Internet
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
243 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
244 {
9c9332e486ca 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 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
246 }
9c9332e486ca 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 if (!certificateKeyPassword_.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
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 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
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 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
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::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
256 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
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.append(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
262 value.append(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
263 }
9c9332e486ca 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 }
808
2d9a000aa3a6 update/delete peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
266 }