feat: oauth2 login via myep
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
namespace App\Controller\Security;
|
||||
|
||||
use App\Security\OAuth2\MyEpClient;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\Routing\Attribute\Route;
|
||||
|
||||
class OAuth2Controller extends AbstractController
|
||||
{
|
||||
public function __construct(private readonly MyEpClient $client)
|
||||
{
|
||||
}
|
||||
|
||||
#[Route('/myep-auth/init', name: 'app_myep_auth_init')]
|
||||
public function init(Request $request): Response
|
||||
{
|
||||
$provider = $this->client->getProvider();
|
||||
$url = $provider->getAuthorizationUrl();
|
||||
$state = $provider->getState();
|
||||
$request->getSession()->set('oauth2state', $state);
|
||||
|
||||
return $this->redirect($url);
|
||||
}
|
||||
|
||||
#[Route('/myep-auth/check', name: 'app_myep_auth_check')]
|
||||
public function check(): void
|
||||
{
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user