mirror of
https://github.com/maelgangloff/domain-watchdog.git
synced 2025-12-17 17:55:42 +00:00
chore: make verifyAuthData private
This commit is contained in:
parent
7a49adcc18
commit
3cae5d717e
@ -14,6 +14,7 @@ use Symfony\Component\DependencyInjection\ContainerInterface;
|
|||||||
use Symfony\Component\HttpFoundation\Request;
|
use Symfony\Component\HttpFoundation\Request;
|
||||||
use Symfony\Component\HttpKernel\Exception\BadRequestHttpException;
|
use Symfony\Component\HttpKernel\Exception\BadRequestHttpException;
|
||||||
use Symfony\Component\Routing\Attribute\Route;
|
use Symfony\Component\Routing\Attribute\Route;
|
||||||
|
use Symfony\Component\Serializer\Exception\ExceptionInterface;
|
||||||
use Symfony\Component\Serializer\SerializerInterface;
|
use Symfony\Component\Serializer\SerializerInterface;
|
||||||
use Symfony\Contracts\HttpClient\HttpClientInterface;
|
use Symfony\Contracts\HttpClient\HttpClientInterface;
|
||||||
|
|
||||||
@ -47,6 +48,7 @@ class ConnectorController extends AbstractController
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @throws \Exception
|
* @throws \Exception
|
||||||
|
* @throws ExceptionInterface
|
||||||
*/
|
*/
|
||||||
#[Route(
|
#[Route(
|
||||||
path: '/api/connectors',
|
path: '/api/connectors',
|
||||||
@ -77,9 +79,7 @@ class ConnectorController extends AbstractController
|
|||||||
|
|
||||||
/** @var AbstractProvider $providerClient */
|
/** @var AbstractProvider $providerClient */
|
||||||
$providerClient = $this->locator->get($provider->getConnectorProvider());
|
$providerClient = $this->locator->get($provider->getConnectorProvider());
|
||||||
$authData = $providerClient->verifyAuthData($connector->getAuthData());
|
$connector->setAuthData($providerClient->authenticate($connector->getAuthData()));
|
||||||
$connector->setAuthData($authData);
|
|
||||||
$providerClient->authenticate($authData);
|
|
||||||
|
|
||||||
$this->logger->info('User {username} authentication data with the {provider} provider has been validated.', [
|
$this->logger->info('User {username} authentication data with the {provider} provider has been validated.', [
|
||||||
'username' => $user->getUserIdentifier(),
|
'username' => $user->getUserIdentifier(),
|
||||||
|
|||||||
@ -41,6 +41,7 @@ use Symfony\Component\HttpFoundation\Response;
|
|||||||
use Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException;
|
use Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException;
|
||||||
use Symfony\Component\HttpKernel\Exception\BadRequestHttpException;
|
use Symfony\Component\HttpKernel\Exception\BadRequestHttpException;
|
||||||
use Symfony\Component\Routing\Attribute\Route;
|
use Symfony\Component\Routing\Attribute\Route;
|
||||||
|
use Symfony\Component\Serializer\Exception\ExceptionInterface;
|
||||||
use Symfony\Component\Serializer\SerializerInterface;
|
use Symfony\Component\Serializer\SerializerInterface;
|
||||||
|
|
||||||
class WatchListController extends AbstractController
|
class WatchListController extends AbstractController
|
||||||
@ -154,6 +155,7 @@ class WatchListController extends AbstractController
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @throws \Exception
|
* @throws \Exception
|
||||||
|
* @throws ExceptionInterface
|
||||||
*/
|
*/
|
||||||
private function verifyConnector(WatchList $watchList, ?Connector $connector): void
|
private function verifyConnector(WatchList $watchList, ?Connector $connector): void
|
||||||
{
|
{
|
||||||
|
|||||||
@ -13,6 +13,7 @@ use Symfony\Component\Mailer\MailerInterface;
|
|||||||
use Symfony\Component\Messenger\Attribute\AsMessageHandler;
|
use Symfony\Component\Messenger\Attribute\AsMessageHandler;
|
||||||
use Symfony\Component\Mime\Address;
|
use Symfony\Component\Mime\Address;
|
||||||
use Symfony\Component\Notifier\Recipient\Recipient;
|
use Symfony\Component\Notifier\Recipient\Recipient;
|
||||||
|
use Symfony\Component\Serializer\Exception\ExceptionInterface;
|
||||||
|
|
||||||
#[AsMessageHandler]
|
#[AsMessageHandler]
|
||||||
final readonly class ValidateConnectorCredentialsHandler
|
final readonly class ValidateConnectorCredentialsHandler
|
||||||
@ -27,6 +28,7 @@ final readonly class ValidateConnectorCredentialsHandler
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @throws TransportExceptionInterface
|
* @throws TransportExceptionInterface
|
||||||
|
* @throws ExceptionInterface
|
||||||
*/
|
*/
|
||||||
public function __invoke(ValidateConnectorCredentials $message): void
|
public function __invoke(ValidateConnectorCredentials $message): void
|
||||||
{
|
{
|
||||||
|
|||||||
@ -52,7 +52,7 @@ abstract class AbstractProvider
|
|||||||
* @throws HttpException when the user does not accept the necessary conditions
|
* @throws HttpException when the user does not accept the necessary conditions
|
||||||
* @throws ExceptionInterface
|
* @throws ExceptionInterface
|
||||||
*/
|
*/
|
||||||
public function verifyAuthData(array $authData): array
|
private function verifyAuthData(array $authData): array
|
||||||
{
|
{
|
||||||
/** @var DefaultProviderDto $data */
|
/** @var DefaultProviderDto $data */
|
||||||
$data = $this->serializer->denormalize($this->verifyLegalAuthData($authData), $this->dtoClass);
|
$data = $this->serializer->denormalize($this->verifyLegalAuthData($authData), $this->dtoClass);
|
||||||
@ -136,10 +136,12 @@ abstract class AbstractProvider
|
|||||||
* @throws ExceptionInterface
|
* @throws ExceptionInterface
|
||||||
* @throws \Exception
|
* @throws \Exception
|
||||||
*/
|
*/
|
||||||
public function authenticate(array $authData): void
|
public function authenticate(array $authData): array
|
||||||
{
|
{
|
||||||
$this->authData = $this->verifyAuthData($authData);
|
$this->authData = $this->verifyAuthData($authData);
|
||||||
$this->assertAuthentication();
|
$this->assertAuthentication();
|
||||||
|
|
||||||
|
return $this->authData;
|
||||||
}
|
}
|
||||||
|
|
||||||
abstract protected function getCachedTldList(): CacheItemInterface;
|
abstract protected function getCachedTldList(): CacheItemInterface;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user