Advertisement
iruindegi

SecurityController.php

Mar 16th, 2023
444
0
Never
1
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.84 KB | None | 0 0
  1. <?php
  2.  
  3. namespace App\Controller;
  4.  
  5. use KnpU\OAuth2ClientBundle\Client\ClientRegistry;
  6. use KnpU\OAuth2ClientBundle\Client\OAuth2Client;
  7. use League\OAuth2\Client\Provider\Exception\IdentityProviderException;
  8. use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
  9. use Symfony\Component\HttpFoundation\Request;
  10. use Symfony\Component\HttpFoundation\Response;
  11. use Symfony\Component\Routing\Annotation\Route;
  12. use Symfony\Component\Security\Http\Authentication\AuthenticationUtils;
  13.  
  14.  
  15. class SecurityController extends AbstractController
  16. {
  17.     #[Route(path: '/login', name: 'app_login')]
  18.    public function login(AuthenticationUtils $authenticationUtils): Response
  19.     {
  20.         // if ($this->getUser()) {
  21.         //     return $this->redirectToRoute('target_path');
  22.         // }
  23.  
  24.         // get the login error if there is one
  25.         $error = $authenticationUtils->getLastAuthenticationError();
  26.         // last username entered by the user
  27.         $lastUsername = $authenticationUtils->getLastUsername();
  28.  
  29.         return $this->render('security/login.html.twig', ['last_username' => $lastUsername, 'error' => $error]);
  30.     }
  31.  
  32.     #[Route(path: '/logout', name: 'app_logout')]
  33.    public function logout(): void
  34.     {
  35.         throw new \LogicException('This method can be blank - it will be intercepted by the logout key on your firewall.');
  36.  
  37.     }
  38.  
  39.     #[Route(path: '/connect', name: 'oauth_connect')]
  40.    public function connect(ClientRegistry $clientRegistry): \Symfony\Component\HttpFoundation\RedirectResponse
  41.     {
  42.         return $clientRegistry->getClient('generic')->redirect(['urn:izenpe:identity:global urn:izenpe:fea:properties urn:safelayer:eidas:authn_details']);
  43.     }
  44.  
  45.     #[Route(path: '/connect/check', name: 'oauth_check')]
  46.    public function check(Request $request, ClientRegistry $clientRegistry)
  47.     {
  48.  
  49.     }
  50. }
  51.  
Advertisement
Comments
  • Brownjhnn454
    1 year
    # text 0.32 KB | 0 0
    1. 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