src/Controller/SecurityController.php line 31

Open in your IDE?
  1. <?php
  2. /**
  3.  * Created by Mediterranean Develup Solutions.
  4.  * User: carlos.rojas@develup.solutions
  5.  * Date: 12/06/2017
  6.  * Time: 17:44
  7.  */
  8. namespace App\Controller;
  9. use App\Entity\Configuration;
  10. use Doctrine\ORM\EntityManagerInterface;
  11. use Symfony\Component\Routing\Annotation\Route;
  12. use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
  13. use Symfony\Component\HttpFoundation\Request;
  14. use Symfony\Component\Security\Http\Authentication\AuthenticationUtils;
  15. class SecurityController extends AbstractController
  16. {
  17.     protected $em;
  18.     function __construct(EntityManagerInterface $em)
  19.     {
  20.         $this->em $em;
  21.     }
  22.     /**
  23.      * @Route("/login", name="login")
  24.      */
  25.     public function loginAction(AuthenticationUtils $authenticationUtilsRequest $request)
  26.     {
  27.         return $this->render(
  28.             'login/login.html.twig',
  29.             array(
  30.                 'last_username' => $authenticationUtils->getLastUsername(),
  31.                 'error'         => $authenticationUtils->getLastAuthenticationError(),
  32.             )
  33.         );
  34.     }
  35.     /**
  36.      * @Route("/kickout", name="kickout")
  37.      */
  38.     public function KickoutAction(Request $request)
  39.     {
  40.         $this->get('security.token_storage')->setToken(null);
  41.         $session $request->getSession();
  42.         $session->invalidate(); //here we can now clear the session.
  43.         return $this->render('kickout/kickout.html.twig');
  44.     }
  45.     /**
  46.      * @Route("/login_check", name="security_login_check")
  47.      */
  48.     public function loginCheckAction()
  49.     {
  50.     }
  51.     /**
  52.      * @Route("/logout", name="logout")
  53.      */
  54.     public function logoutAction()
  55.     {
  56.     }
  57.     public function getLicencias(){
  58.         $repository $this->em->getRepository(Configuration::class);
  59.         $configuration $repository->findOneById(1);
  60.         return $configuration->getLicenses();
  61.     }
  62. }