mirror of
https://github.com/maelgangloff/domain-watchdog.git
synced 2025-12-29 16:15:04 +00:00
feat: issue JWT cookie when OAuth
This commit is contained in:
@@ -3,13 +3,9 @@
|
||||
namespace App\Controller;
|
||||
|
||||
use KnpU\OAuth2ClientBundle\Client\ClientRegistry;
|
||||
use Lexik\Bundle\JWTAuthenticationBundle\Services\JWTTokenManagerInterface;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
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
|
||||
{
|
||||
@@ -25,11 +21,4 @@ class HomeController extends AbstractController
|
||||
{
|
||||
return $clientRegistry->getClient('oauth')->redirect();
|
||||
}
|
||||
|
||||
#[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