Commit 5b5c2bb6 authored by Mat's avatar Mat

init sécurité de l'API. Teste d'abord la route delete dans postman ->

url: 0.0.0.0:81/web/app_dev.php/API/v2/brasserie/7
method: DELETE
response: {"code":401,"message":"JWT Token not found"}
parent b2a12040
......@@ -27,6 +27,12 @@ security:
dev:
pattern: ^/(_profiler|_wdt|css|images|js)/
security: false
api:
pattern: ^/API/
stateless: true
guard:
authenticators:
- lexik_jwt_authentication.jwt_token_authenticator
main:
pattern: ^/
anonymous: true
......
......@@ -7,6 +7,7 @@ use Api2Bundle\Entity\Pays;
use Api2Bundle\Form\BrasserieType;
use FOS\RestBundle\Controller\Annotations as Rest;
use FOS\RestBundle\Controller\FOSRestController;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Security;
use Symfony\Component\HttpFoundation\Request;
class BrasserieController extends FOSRestController
......@@ -103,6 +104,7 @@ class BrasserieController extends FOSRestController
* @Rest\Delete(path="/brasserie/{brasserieId}")
* @Rest\View()
* @return Brasserie
* @Security("has_role('ROLE_USER')")
*/
public function deleteAction(Brasserie $brasserieId)
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment