Subsonic API: added a way to disable the user/password authentication method (enabled by default)
This commit is contained in:
@@ -298,6 +298,7 @@ namespace lms::api::subsonic
|
||||
: _serverProtocolVersionsByClient{ readConfigProtocolVersions() }
|
||||
, _openSubsonicDisabledClients{ readOpenSubsonicDisabledClients() }
|
||||
, _defaultReleaseCoverClients{ readDefaultCoverClients() }
|
||||
, _supportUserPasswordAuthentication{ core::Service<core::IConfig>::get()->getBool("api-subsonic-support-user-password-auth", true) }
|
||||
, _db{ db }
|
||||
{
|
||||
}
|
||||
@@ -451,6 +452,9 @@ namespace lms::api::subsonic
|
||||
|
||||
const auto user{ getParameterAs<std::string>(parameters, "u") };
|
||||
const auto password{ getParameterAs<std::string>(parameters, "p") };
|
||||
if (!_supportUserPasswordAuthentication && (password || user))
|
||||
throw ProvidedAuthenticationMechanismNotSupportedError{};
|
||||
|
||||
const auto apiKey{ getParameterAs<std::string>(parameters, "apiKey") };
|
||||
|
||||
if (user && !password)
|
||||
|
||||
@@ -55,6 +55,7 @@ namespace lms::api::subsonic
|
||||
const std::unordered_map<std::string, ProtocolVersion> _serverProtocolVersionsByClient;
|
||||
const std::unordered_set<std::string> _openSubsonicDisabledClients;
|
||||
const std::unordered_set<std::string> _defaultReleaseCoverClients;
|
||||
const bool _supportUserPasswordAuthentication;
|
||||
|
||||
db::Db& _db;
|
||||
};
|
||||
|
||||
@@ -557,6 +557,7 @@ namespace lms::ui
|
||||
// Subsonic
|
||||
{
|
||||
t->setCondition("if-has-subsonic-api", core::Service<core::IConfig>::get()->getBool("api-subsonic", true));
|
||||
t->setCondition("if-has-subsonic-token-usage", core::Service<core::IConfig>::get()->getBool("api-subsonic-support-user-password-auth", true));
|
||||
|
||||
auto subsonicToken{ std::make_unique<Wt::WLineEdit>() };
|
||||
Wt::WLineEdit* subsonicTokenPtr{ subsonicToken.get() };
|
||||
|
||||
Reference in New Issue
Block a user