Base du projet 'application ticketing'
This commit is contained in:
24
backend/src/Controller/SecurityController.php
Normal file
24
backend/src/Controller/SecurityController.php
Normal file
@ -0,0 +1,24 @@
|
||||
<?php
|
||||
namespace App\Controller;
|
||||
|
||||
use App\Http\DataResponse;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
|
||||
use Symfony\Component\HttpFoundation\JsonResponse;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\Routing\Annotation\Route;
|
||||
|
||||
class SecurityController extends Controller
|
||||
{
|
||||
/**
|
||||
* @Route("/api/v1/login", name="api_v1_login", methods={"POST"})
|
||||
*/
|
||||
public function login(Request $request)
|
||||
{
|
||||
$user = $this->getUser();
|
||||
|
||||
return new DataResponse([
|
||||
'username' => $user->getUsername(),
|
||||
'roles' => $user->getRoles(),
|
||||
]);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user