24 lines
624 B
PHP
24 lines
624 B
PHP
<?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(),
|
|
]);
|
|
}
|
|
} |