feat: integrated OAuth2 server
This commit is contained in:
@@ -7,15 +7,17 @@ use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Symfony\Component\HttpFoundation\JsonResponse;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\Routing\Attribute\Route;
|
||||
use Symfony\Component\Security\Http\Attribute\IsGranted;
|
||||
|
||||
#[Route('/api')]
|
||||
#[IsGranted('ROLE_OAUTH2_API')]
|
||||
class PickupController extends AbstractController
|
||||
{
|
||||
public function __construct(private readonly PickupLoader $xmlLoader)
|
||||
{
|
||||
}
|
||||
|
||||
#[Route('/pickups', name: 'api_pickup_all')]
|
||||
#[Route('/pickups', name: 'api_pickups_all')]
|
||||
public function index(): JsonResponse
|
||||
{
|
||||
$pickups = $this->xmlLoader->loadAll();
|
||||
@@ -23,11 +25,11 @@ class PickupController extends AbstractController
|
||||
return $this->json($pickups, Response::HTTP_OK, [], ['groups' => 'api:list']);
|
||||
}
|
||||
|
||||
#[Route('/pickups/{id}', name: 'api_pickup_single')]
|
||||
#[Route('/pickups/{id}', name: 'api_pickups_single')]
|
||||
public function single(int $id): JsonResponse
|
||||
{
|
||||
$pickup = $this->xmlLoader->loadById($id);
|
||||
|
||||
return $this->json($pickup, Response::HTTP_OK, [], ['groups' => 'api:list']);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user