<?php
/**
* Created by Mediterranean Develup Solutions.
* User: carlos.rojas@develup.solutions
* Date: 12/06/2017
* Time: 17:44
*/
namespace App\Controller;
use App\Entity\Configuration;
use Doctrine\ORM\EntityManagerInterface;
use Symfony\Component\Routing\Annotation\Route;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\Security\Http\Authentication\AuthenticationUtils;
class SecurityController extends AbstractController
{
protected $em;
function __construct(EntityManagerInterface $em)
{
$this->em = $em;
}
/**
* @Route("/login", name="login")
*/
public function loginAction(AuthenticationUtils $authenticationUtils, Request $request)
{
return $this->render(
'login/login.html.twig',
array(
'last_username' => $authenticationUtils->getLastUsername(),
'error' => $authenticationUtils->getLastAuthenticationError(),
)
);
}
/**
* @Route("/kickout", name="kickout")
*/
public function KickoutAction(Request $request)
{
$this->get('security.token_storage')->setToken(null);
$session = $request->getSession();
$session->invalidate(); //here we can now clear the session.
return $this->render('kickout/kickout.html.twig');
}
/**
* @Route("/login_check", name="security_login_check")
*/
public function loginCheckAction()
{
}
/**
* @Route("/logout", name="logout")
*/
public function logoutAction()
{
}
public function getLicencias(){
$repository = $this->em->getRepository(Configuration::class);
$configuration = $repository->findOneById(1);
return $configuration->getLicenses();
}
}