Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- namespace App\Controller;
- use KnpU\OAuth2ClientBundle\Client\ClientRegistry;
- use KnpU\OAuth2ClientBundle\Client\OAuth2Client;
- use League\OAuth2\Client\Provider\Exception\IdentityProviderException;
- use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
- use Symfony\Component\HttpFoundation\Request;
- use Symfony\Component\HttpFoundation\Response;
- use Symfony\Component\Routing\Annotation\Route;
- use Symfony\Component\Security\Http\Authentication\AuthenticationUtils;
- class SecurityController extends AbstractController
- {
- #[Route(path: '/login', name: 'app_login')]
- public function login(AuthenticationUtils $authenticationUtils): Response
- {
- // if ($this->getUser()) {
- // return $this->redirectToRoute('target_path');
- // }
- // get the login error if there is one
- $error = $authenticationUtils->getLastAuthenticationError();
- // last username entered by the user
- $lastUsername = $authenticationUtils->getLastUsername();
- return $this->render('security/login.html.twig', ['last_username' => $lastUsername, 'error' => $error]);
- }
- #[Route(path: '/logout', name: 'app_logout')]
- public function logout(): void
- {
- throw new \LogicException('This method can be blank - it will be intercepted by the logout key on your firewall.');
- }
- #[Route(path: '/connect', name: 'oauth_connect')]
- public function connect(ClientRegistry $clientRegistry): \Symfony\Component\HttpFoundation\RedirectResponse
- {
- return $clientRegistry->getClient('generic')->redirect(['urn:izenpe:identity:global urn:izenpe:fea:properties urn:safelayer:eidas:authn_details']);
- }
- #[Route(path: '/connect/check', name: 'oauth_check')]
- public function check(Request $request, ClientRegistry $clientRegistry)
- {
- }
- }
Advertisement
Comments
-
- Comme nous vivons dans un monde où de plus en plus d'appareils distants peuvent transmettre des données partout dans le monde, les brouilleurs sont appelés à devenir de plus en plus populaires, en tant que l'un des leaders des brouilleurs, nous vous proposons les meilleurs produits de qualité. https://www.jammer5g.com/
Add Comment
Please, Sign In to add comment
Advertisement