mirror of
https://github.com/maelgangloff/domain-watchdog.git
synced 2025-12-29 16:15:04 +00:00
test: update test suite
This commit is contained in:
@@ -5,15 +5,19 @@ namespace App\Controller;
|
||||
use KnpU\OAuth2ClientBundle\Client\ClientRegistry;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Symfony\Bundle\SecurityBundle\Security;
|
||||
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface;
|
||||
use Symfony\Component\HttpFoundation\RedirectResponse;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
||||
use Symfony\Component\Routing\Attribute\Route;
|
||||
use Symfony\Component\Routing\RouterInterface;
|
||||
|
||||
class HomeController extends AbstractController
|
||||
{
|
||||
public function __construct(private readonly RouterInterface $router)
|
||||
{
|
||||
public function __construct(
|
||||
private readonly RouterInterface $router,
|
||||
private readonly ParameterBagInterface $parameterBag,
|
||||
) {
|
||||
}
|
||||
|
||||
#[Route(path: '/', name: 'index')]
|
||||
@@ -25,7 +29,10 @@ class HomeController extends AbstractController
|
||||
#[Route(path: '/login/oauth', name: 'oauth_connect')]
|
||||
public function connectAction(ClientRegistry $clientRegistry): Response
|
||||
{
|
||||
return $clientRegistry->getClient('oauth')->redirect([], []);
|
||||
if ($this->parameterBag->get('oauth_enabled')) {
|
||||
return $clientRegistry->getClient('oauth')->redirect([], []);
|
||||
}
|
||||
throw new NotFoundHttpException();
|
||||
}
|
||||
|
||||
#[Route(path: '/logout', name: 'logout')]
|
||||
|
||||
Reference in New Issue
Block a user