# HG changeset patch # User Sebastien Jodogne # Date 1560498972 -7200 # Node ID 798951e457f3be153facb829482cdc7a1a707aab # Parent 340f02ddaabf53c9315f153fc9ef7fd5ea7a1c2c fix parsing of authorization header diff -r 340f02ddaabf -r 798951e457f3 Plugin/GoogleAccount.cpp --- 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 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;