fix: update login

This commit is contained in:
Maël Gangloff
2024-07-22 13:39:45 +02:00
parent 9e8523fa53
commit 1642767993
12 changed files with 33 additions and 10851 deletions

View File

@@ -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)]);
}
}
}