Mercurial > hg > orthanc-gcp
changeset 11:798951e457f3
fix parsing of authorization header
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Fri, 14 Jun 2019 09:56:12 +0200 |
parents | 340f02ddaabf |
children | 42a6a2dd54ff |
files | Plugin/GoogleAccount.cpp |
diffstat | 1 files changed, 11 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/Plugin/GoogleAccount.cpp Fri Jun 14 08:13:01 2019 +0200 +++ b/Plugin/GoogleAccount.cpp Fri Jun 14 09:56:12 2019 +0200 @@ -31,6 +31,7 @@ #include "GoogleAccount.h" +#include <Core/Toolbox.h> void GoogleAccount::LoadAuthorizedUser(const std::string& json) { @@ -216,8 +217,17 @@ "/dicomStores/" + dicomStore_ + "/dicomWeb/"); + size_t colon = token.find(':'); + if (colon == std::string::npos) + { + throw Orthanc::OrthancException(Orthanc::ErrorCode_InternalError); + } + + std::string headerKey = Orthanc::Toolbox::StripSpaces(token.substr(0, colon)); + std::string headerValue = Orthanc::Toolbox::StripSpaces(token.substr(colon + 1)); + Json::Value headers = Json::objectValue; - headers["Authorization"] = "Bearer " + token; + headers[headerKey] = headerValue; Json::Value server = Json::objectValue; server["Url"] = url;