Mercurial > hg > orthanc
diff Core/WebServiceParameters.cpp @ 3192:595bfee4391a
URI "/peers?expand" provides more information
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Tue, 05 Feb 2019 06:44:36 +0100 |
parents | 4e43e67f8ecf |
children | 6fe42a335a80 |
line wrap: on
line diff
--- a/Core/WebServiceParameters.cpp Mon Feb 04 21:09:44 2019 +0100 +++ b/Core/WebServiceParameters.cpp Tue Feb 05 06:44:36 2019 +0100 @@ -502,4 +502,47 @@ } } #endif + + + void WebServiceParameters::FormatPublic(Json::Value& target) const + { + target = Json::objectValue; + + // Only return the public information identifying the destination. + // "Security"-related information such as passwords and HTTP + // headers are shown as "null" values. + target[KEY_URL] = url_; + + if (!username_.empty()) + { + target[KEY_USERNAME] = username_; + target[KEY_PASSWORD] = Json::nullValue; + } + + if (!certificateFile_.empty()) + { + target[KEY_CERTIFICATE_FILE] = certificateFile_; + target[KEY_CERTIFICATE_KEY_FILE] = Json::nullValue; + target[KEY_CERTIFICATE_KEY_PASSWORD] = Json::nullValue; + } + + target[KEY_PKCS11] = pkcs11Enabled_; + + Json::Value headers = Json::arrayValue; + + for (Dictionary::const_iterator it = headers_.begin(); + it != headers_.end(); ++it) + { + // Only list the HTTP headers, not their value + headers.append(it->first); + } + + target[KEY_HTTP_HEADERS] = headers; + + for (Dictionary::const_iterator it = userProperties_.begin(); + it != userProperties_.end(); ++it) + { + target[it->first] = it->second; + } + } }