Subsonic API: removed useless auth

This commit is contained in:
emeric
2023-11-11 23:45:03 +01:00
parent 6d50783511
commit 07949de20f
+14 -1
View File
@@ -399,6 +399,19 @@ namespace API::Subsonic
Database::UserId SubsonicResource::authenticateUser(const Wt::Http::Request& request, const ClientInfo& clientInfo) Database::UserId SubsonicResource::authenticateUser(const Wt::Http::Request& request, const ClientInfo& clientInfo)
{ {
// if the request if a continuation, the user is already authenticated
if (request.continuation())
{
Database::Session& session{ _db.getTLSSession() };
auto transaction{ session.createSharedTransaction() };
const auto user{ Database::User::find(session, clientInfo.user) };
if (!user)
throw UserNotAuthorizedError{};
return user->getId();
}
if (auto * authEnvService{ Service<::Auth::IEnvService>::get() }) if (auto * authEnvService{ Service<::Auth::IEnvService>::get() })
{ {
const auto checkResult{ authEnvService->processRequest(request) }; const auto checkResult{ authEnvService->processRequest(request) };
@@ -423,7 +436,7 @@ namespace API::Subsonic
} }
} }
throw InternalErrorGenericError{ "No service avalaible to authenticate user" }; throw InternalErrorGenericError{ "No service available to authenticate user" };
} }
} // namespace api::subsonic } // namespace api::subsonic