Split auth service in two services

This commit is contained in:
emeric
2019-07-30 13:17:25 +02:00
parent d114c763c3
commit 40000249c6
12 changed files with 363 additions and 235 deletions
+5 -5
View File
@@ -26,7 +26,7 @@
#include <Wt/WLocalDateTime.h>
#include "auth/AuthService.hpp"
#include "auth/PasswordService.hpp"
#include "av/AvTranscoder.hpp"
#include "cover/CoverArtGrabber.hpp"
#include "database/Artist.hpp"
@@ -406,15 +406,15 @@ SubsonicResource::handleRequest(const Wt::Http::Request &request, Wt::Http::Resp
const ClientInfo clientInfo {getClientInfo(parameters)};
switch (getService<Auth::AuthService>()->checkUserPassword(dbSession,
switch (getService<Auth::PasswordService>()->checkUserPassword(dbSession,
boost::asio::ip::address::from_string(request.clientAddress()),
clientInfo.user, clientInfo.password))
{
case Auth::AuthService::PasswordCheckResult::Match:
case Auth::PasswordService::PasswordCheckResult::Match:
break;
case Auth::AuthService::PasswordCheckResult::Mismatch:
case Auth::PasswordService::PasswordCheckResult::Mismatch:
throw Error {Error::Code::WrongUsernameOrPassword};
case Auth::AuthService::PasswordCheckResult::Throttled:
case Auth::PasswordService::PasswordCheckResult::Throttled:
throw Error {Error::CustomType::LoginThrottled};
}