annotate Core/WebServiceParameters.cpp @ 2103:a89ca69ec1d1

ImageAccessor::SetFormat
author Sebastien Jodogne <s.jodogne@gmail.com>
date Thu, 13 Oct 2016 11:42:30 +0200
parents 5b93382f88e1
children aa4b8895cd23
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"
9c9332e486ca HTTPS client certificates can be associated with Orthanc peers to enhance security over Internet
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
37 #include "../Core/Toolbox.h"
808
2d9a000aa3a6 update/delete peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
38 #include "../Core/OrthancException.h"
2d9a000aa3a6 update/delete peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
39
2021
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2020
diff changeset
40 #include <cassert>
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2020
diff changeset
41
808
2d9a000aa3a6 update/delete peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
42 namespace Orthanc
2d9a000aa3a6 update/delete peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
43 {
2020
a0bd8cd55da7 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2019
diff changeset
44 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
45 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
46 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
47 pkcs11Enabled_(false)
808
2d9a000aa3a6 update/delete peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
48 {
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
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 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
53 {
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 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
55 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
56 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
57 }
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
2020
a0bd8cd55da7 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2019
diff changeset
60 void WebServiceParameters::SetClientCertificate(const std::string& certificateFile,
a0bd8cd55da7 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2019
diff changeset
61 const std::string& certificateKeyFile,
a0bd8cd55da7 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2019
diff changeset
62 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
63 {
9c9332e486ca 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 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
65 {
9c9332e486ca 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 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
67 }
9c9332e486ca 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 if (!Toolbox::IsRegularFile(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
70 {
9c9332e486ca 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 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
72 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
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
9c9332e486ca 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 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
76 !Toolbox::IsRegularFile(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
77 {
9c9332e486ca 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 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
79 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
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
9c9332e486ca 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 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
83 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
84 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
85 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
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
9c9332e486ca 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 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
90 {
9c9332e486ca 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 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
92 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
93 {
9c9332e486ca 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 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
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 }
9c9332e486ca 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
2020
a0bd8cd55da7 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2019
diff changeset
99 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
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 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
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 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
104 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
105
9c9332e486ca 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 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
107 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
108 {
9c9332e486ca 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 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
110 }
9c9332e486ca 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 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
113 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
114 {
9c9332e486ca 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 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
116 }
9c9332e486ca 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 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
119 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
120
9c9332e486ca 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 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
122 {
9c9332e486ca 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 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
124 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
125 }
9c9332e486ca 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 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
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 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
129 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
130 }
9c9332e486ca 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 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
132 {
9c9332e486ca 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 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
134 }
9c9332e486ca 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 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
139 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
140 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
141 {
9c9332e486ca 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 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
143 {
9c9332e486ca 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 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
145 }
9c9332e486ca 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 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
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 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
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 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
151 {
9c9332e486ca 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 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
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 }
9c9332e486ca 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
2020
a0bd8cd55da7 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2019
diff changeset
157 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
158 {
9c9332e486ca 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 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
160 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
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 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
163 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
164 {
9c9332e486ca 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 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
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 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
169 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
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 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
172 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
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 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
175 {
9c9332e486ca 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 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
177 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
178 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
179 }
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
180
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 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
182 {
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 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
184 {
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 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
186 }
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 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
188 {
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 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
190 }
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 }
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
192 }
9c9332e486ca 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
2020
a0bd8cd55da7 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2019
diff changeset
195 void WebServiceParameters::FromJson(const Json::Value& peer)
808
2d9a000aa3a6 update/delete peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
196 {
2d9a000aa3a6 update/delete peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
197 try
2d9a000aa3a6 update/delete peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
198 {
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
199 if (peer.isArray())
808
2d9a000aa3a6 update/delete peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
200 {
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
201 FromJsonArray(peer);
808
2d9a000aa3a6 update/delete peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
202 }
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
203 else if (peer.isObject())
808
2d9a000aa3a6 update/delete peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
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 FromJsonObject(peer);
808
2d9a000aa3a6 update/delete peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
206 }
2d9a000aa3a6 update/delete peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
207 else
2d9a000aa3a6 update/delete peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
208 {
2d9a000aa3a6 update/delete peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
209 throw OrthancException(ErrorCode_BadFileFormat);
2d9a000aa3a6 update/delete peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
210 }
2d9a000aa3a6 update/delete peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
211 }
2042
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2032
diff changeset
212 catch (OrthancException&)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2032
diff changeset
213 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2032
diff changeset
214 throw;
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2032
diff changeset
215 }
808
2d9a000aa3a6 update/delete peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
216 catch (...)
2d9a000aa3a6 update/delete peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
217 {
2d9a000aa3a6 update/delete peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
218 throw OrthancException(ErrorCode_BadFileFormat);
2d9a000aa3a6 update/delete peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
219 }
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
2020
a0bd8cd55da7 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2019
diff changeset
223 void WebServiceParameters::ToJson(Json::Value& value) const
808
2d9a000aa3a6 update/delete peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
224 {
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
225 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
226 {
9c9332e486ca HTTPS client certificates can be associated with Orthanc peers to enhance security over Internet
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
227 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
228 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
229
9c9332e486ca 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 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
231 !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
232 {
9c9332e486ca 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 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
234 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
235 }
9c9332e486ca 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 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
238 {
9c9332e486ca 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 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
240 }
9c9332e486ca 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 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
243 {
9c9332e486ca 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 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
245 }
9c9332e486ca HTTPS client certificates can be associated with Orthanc peers to enhance security over Internet
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
246
9c9332e486ca 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 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
248 {
9c9332e486ca 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 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
250 }
9c9332e486ca HTTPS client certificates can be associated with Orthanc peers to enhance security over Internet
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
251 }
9c9332e486ca HTTPS client certificates can be associated with Orthanc peers to enhance security over Internet
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
252 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
253 {
9c9332e486ca 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 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
255 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
256
9c9332e486ca HTTPS client certificates can be associated with Orthanc peers to enhance security over Internet
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
257 if (!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
258 !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
259 {
9c9332e486ca 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 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
261 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
262 }
9c9332e486ca HTTPS client certificates can be associated with Orthanc peers to enhance security over Internet
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
263 }
9c9332e486ca 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 }
808
2d9a000aa3a6 update/delete peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
265 }