Log auth error

This commit is contained in:
badaix 2025-02-09 21:21:03 +01:00
parent fd7802c6fc
commit f6b1e3f5d4
2 changed files with 7 additions and 1 deletions

View file

@ -893,14 +893,20 @@ void ServerAuthenticateRequest::execute(const jsonrpcpp::request_ptr& request, A
auto scheme = request->params().get<std::string>("scheme");
auto param = request->params().get<std::string>("param");
// TODO: don't log passwords
LOG(INFO, LOG_TAG) << "Authorization scheme: " << scheme << ", param: " << param << "\n";
auto ec = authinfo.authenticate(scheme, param);
std::shared_ptr<jsonrpcpp::Response> response;
if (ec)
{
LOG(ERROR, LOG_TAG) << "Auth error: " << ec.detailed_message() << "\n";
response = std::make_shared<jsonrpcpp::Response>(request->id(), jsonrpcpp::Error(ec.detailed_message(), ec.value()));
}
else
{
response = std::make_shared<jsonrpcpp::Response>(request->id(), "ok");
}
// LOG(DEBUG, LOG_TAG) << response->to_json().dump() << "\n";
on_response(std::move(response), nullptr);

View file

@ -116,7 +116,7 @@ public:
virtual void onChunkRead(const PcmStream* pcmStream, const msg::PcmChunk& chunk) = 0;
/// Chunk @p chunk with duration @p duration of stream @pcmStream has been encoded
virtual void onChunkEncoded(const PcmStream* pcmStream, std::shared_ptr<msg::PcmChunk> chunk, double duration) = 0;
/// Stream @p pcmStream muissed to read audio with duration @p ms
/// Stream @p pcmStream muissed to read audio with duration @p ms
virtual void onResync(const PcmStream* pcmStream, double ms) = 0;
};