mirror of
https://github.com/maelgangloff/domain-watchdog.git
synced 2025-12-29 16:15:04 +00:00
fix: update login
This commit is contained in:
@@ -9,26 +9,21 @@ use Symfony\Component\HttpFoundation\JsonResponse;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\Routing\Attribute\Route;
|
||||
use Symfony\Component\Security\Core\User\UserInterface;
|
||||
use Symfony\Component\Security\Http\Attribute\IsGranted;
|
||||
|
||||
class HomeController extends AbstractController
|
||||
{
|
||||
|
||||
#[Route(path: "/", name: "index")]
|
||||
public function index(): Response
|
||||
{
|
||||
return $this->render('index.html.twig');
|
||||
}
|
||||
|
||||
|
||||
#[Route(path: "/login/oauth", name: "connect_start")]
|
||||
#[Route(path: "/login/oauth", name: "oauth_connect")]
|
||||
public function connectAction(ClientRegistry $clientRegistry): Response
|
||||
{
|
||||
return $clientRegistry->getClient('oauth')->redirect();
|
||||
}
|
||||
|
||||
#[Route(path: "/login/oauth/token", name: "login_oauth_token")]
|
||||
public function getToken(UserInterface $user, JWTTokenManagerInterface $JWTManager): JsonResponse
|
||||
#[Route(path: "/login/oauth/token", name: "oauth_connect_token")]
|
||||
#[IsGranted('IS_AUTHENTICATED_FULLY')]
|
||||
public function loginOAuthToken(UserInterface $user, JWTTokenManagerInterface $JWTManager): JsonResponse
|
||||
{
|
||||
return new JsonResponse(['token' => $JWTManager->create($user)]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user