Subsonic API: removed useless auth
This commit is contained in:
@@ -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
|
||||||
|
|||||||
Reference in New Issue
Block a user