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 HotelController extends AbstractController
|
||||
{
|
||||
public function __construct(private readonly HotelLoader $xmlLoader)
|
||||
{
|
||||
}
|
||||
|
||||
#[Route('/hotels', name: 'api_hotel_all')]
|
||||
#[Route('/hotels', name: 'api_hotels_all')]
|
||||
public function index(): JsonResponse
|
||||
{
|
||||
$hotels = $this->xmlLoader->loadAll();
|
||||
@@ -34,4 +36,4 @@ class HotelController extends AbstractController
|
||||
|
||||
return $this->json($hotel, Response::HTTP_OK, [], ['groups' => 'api:single']);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user