src/JuridicusBundle/Controller/SecurityController.php line 54

Open in your IDE?
  1. <?php
  2. namespace JF\JuridicusBundle\Controller;
  3. use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
  4. //use Symfony\Component\Security\Core\SecurityContext;
  5. use Symfony\Component\Security\Core\Security;
  6. use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
  7. use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
  8. use Symfony\Component\HttpFoundation\Response;
  9. use Symfony\Component\HttpFoundation\Request;
  10. use Symfony\Component\Security\Http\Authentication\AuthenticationUtils;
  11. class SecurityController extends AbstractController
  12. {
  13. public function __construct(AuthenticationUtils $authenticationUtils)
  14. {
  15. $this->authenticationUtils = $authenticationUtils;
  16. }
  17. public function getTokenAction()
  18. {
  19. return new Response($this->get('form.csrf_provider')->generateCsrfToken('authenticate'));
  20. }
  21. /**
  22. * Pruefer-Login
  23. *
  24. * @Route("/pruefer/login", name="pruefer_login")
  25. */
  26. public function prueferLoginAction(Request $request)
  27. {
  28. //$authenticationUtils = $this->get('security.authentication_utils');
  29. // get the login error if there is one
  30. $error = $this->authenticationUtils->getLastAuthenticationError();
  31. // last username entered by the user
  32. $lastUsername = $this->authenticationUtils->getLastUsername();
  33. return $this->render('@JFJuridicusBundle/Login/prueferLogin.html.twig', array(
  34. 'last_username' => $lastUsername,
  35. 'error' => $error,
  36. ));
  37. }
  38. /**
  39. * @Route("/login", name="login")
  40. * @Template()
  41. */
  42. public function loginAction()
  43. {
  44. //$authenticationUtils = $this->get('security.authentication_utils');
  45. // get the login error if there is one
  46. $error = $this->authenticationUtils->getLastAuthenticationError();
  47. // last username entered by the user
  48. $lastUsername = $this->authenticationUtils->getLastUsername();
  49. return $this->render('@JFJuridicusBundle/Login/index.html.twig', array(
  50. 'last_username' => $lastUsername,
  51. 'error' => $error,
  52. ));
  53. }
  54. /**
  55. * @Route("/pruefer/login_check", name="pruefer_login_check")
  56. */
  57. public function prueferSecurityCheckAction()
  58. {
  59. // The security layer will intercept this request
  60. }
  61. /**
  62. * @Route("/pruefer/logout", name="pruefer_logout")
  63. * @Template()
  64. */
  65. public function prueferLogoutAction()
  66. {
  67. // The security layer will intercept this request
  68. }
  69. /**
  70. * Admin-Login
  71. *
  72. * @Route("/admin/login", name="admin_login")
  73. */
  74. public function adminLoginAction(): Response
  75. {
  76. //$authenticationUtils = $this->get('security.authentication_utils');
  77. // get the login error if there is one
  78. $error = $this->authenticationUtils->getLastAuthenticationError();
  79. // last username entered by the user
  80. $lastUsername = $this->authenticationUtils->getLastUsername();
  81. return $this->render('@JFJuridicusBundle/Login/admin.html.twig', array(
  82. 'last_username' => $lastUsername,
  83. 'error' => $error,
  84. ));
  85. }
  86. /**
  87. * @Route("/admin/logout", name="admin_logout")
  88. */
  89. public function adminLogoutAction(): void
  90. {
  91. // The security layer will intercept this request
  92. }
  93. }