# HG changeset patch # User Sebastien Jodogne # Date 1532630583 -7200 # Node ID c7313e1f764409edd78af16d3f6b1d0e02caf033 # Parent 2a4ac74da1ed2f9d5682300894554cd70087bf1f MongooseServer::SetRealm() diff -r 2a4ac74da1ed -r c7313e1f7644 Core/HttpServer/MongooseServer.cpp --- a/Core/HttpServer/MongooseServer.cpp Thu Jul 26 14:02:20 2018 +0200 +++ b/Core/HttpServer/MongooseServer.cpp Thu Jul 26 20:43:03 2018 +0200 @@ -611,7 +611,7 @@ if (!server.IsRemoteAccessAllowed() && !localhost) { - output.SendUnauthorized(ORTHANC_REALM); + output.SendUnauthorized(server.GetRealm()); return; } @@ -655,7 +655,7 @@ if (server.IsAuthenticationEnabled() && !IsAccessGranted(server, headers)) { - output.SendUnauthorized(ORTHANC_REALM); + output.SendUnauthorized(server.GetRealm()); return; } @@ -682,7 +682,7 @@ if (!filter->IsAllowed(method, request->uri, remoteIp, username.c_str(), headers, argumentsGET)) { - //output.SendUnauthorized(ORTHANC_REALM); + //output.SendUnauthorized(server.GetRealm()); output.SendStatus(HttpStatus_403_Forbidden); return; } @@ -917,6 +917,7 @@ keepAlive_ = false; httpCompression_ = true; exceptionFormatter_ = NULL; + realm_ = ORTHANC_REALM; #if ORTHANC_ENABLE_SSL == 1 // Check for the Heartbleed exploit diff -r 2a4ac74da1ed -r c7313e1f7644 Core/HttpServer/MongooseServer.h --- a/Core/HttpServer/MongooseServer.h Thu Jul 26 14:02:20 2018 +0200 +++ b/Core/HttpServer/MongooseServer.h Thu Jul 26 20:43:03 2018 +0200 @@ -96,6 +96,7 @@ bool keepAlive_; bool httpCompression_; IHttpExceptionFormatter* exceptionFormatter_; + std::string realm_; bool IsRunning() const; @@ -188,5 +189,15 @@ { return exceptionFormatter_; } + + const std::string& GetRealm() const + { + return realm_; + } + + void SetRealm(const std::string& realm) + { + realm_ = realm; + } }; }