Mercurial > hg > orthanc
comparison OrthancServer/OrthancConfiguration.cpp @ 3500:0d248cc63ded
Security: If remote HTTP access is enabled, HTTP authentication automatically gets enabled
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Fri, 23 Aug 2019 21:32:16 +0200 |
parents | 8f44dadcdbc1 |
children | d2b9981017c4 |
comparison
equal
deleted
inserted
replaced
3499:d8f7c3970e25 | 3500:0d248cc63ded |
---|---|
609 target.insert(it->first); | 609 target.insert(it->first); |
610 } | 610 } |
611 } | 611 } |
612 | 612 |
613 | 613 |
614 void OrthancConfiguration::SetupRegisteredUsers(HttpServer& httpServer) const | 614 bool OrthancConfiguration::SetupRegisteredUsers(HttpServer& httpServer) const |
615 { | 615 { |
616 httpServer.ClearUsers(); | 616 httpServer.ClearUsers(); |
617 | 617 |
618 if (!json_.isMember("RegisteredUsers")) | 618 if (!json_.isMember("RegisteredUsers")) |
619 { | 619 { |
620 return; | 620 return false; |
621 } | 621 } |
622 | 622 |
623 const Json::Value& users = json_["RegisteredUsers"]; | 623 const Json::Value& users = json_["RegisteredUsers"]; |
624 if (users.type() != Json::objectValue) | 624 if (users.type() != Json::objectValue) |
625 { | 625 { |
626 throw OrthancException(ErrorCode_BadFileFormat, "Badly formatted list of users"); | 626 throw OrthancException(ErrorCode_BadFileFormat, "Badly formatted list of users"); |
627 } | 627 } |
628 | 628 |
629 bool hasUser = false; | |
629 Json::Value::Members usernames = users.getMemberNames(); | 630 Json::Value::Members usernames = users.getMemberNames(); |
630 for (size_t i = 0; i < usernames.size(); i++) | 631 for (size_t i = 0; i < usernames.size(); i++) |
631 { | 632 { |
632 const std::string& username = usernames[i]; | 633 const std::string& username = usernames[i]; |
633 std::string password = users[username].asString(); | 634 std::string password = users[username].asString(); |
634 httpServer.RegisterUser(username.c_str(), password.c_str()); | 635 httpServer.RegisterUser(username.c_str(), password.c_str()); |
635 } | 636 hasUser = true; |
637 } | |
638 | |
639 return hasUser; | |
636 } | 640 } |
637 | 641 |
638 | 642 |
639 std::string OrthancConfiguration::InterpretStringParameterAsPath( | 643 std::string OrthancConfiguration::InterpretStringParameterAsPath( |
640 const std::string& parameter) const | 644 const std::string& parameter) const |