From ea13807c7e2fad8d0f078831647471cd74386bee Mon Sep 17 00:00:00 2001
From: Christoph Reiter <reiter.christoph@gmail.com>
Date: Wed, 21 Sep 2022 10:36:31 +0200
Subject: [PATCH] Add back the security annotations

api-platform tries to deserialize before the security checks in the persister
and we don't get the right error codes on un-auth access otherwise.
---
 src/Entity/ProxyData.php | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/Entity/ProxyData.php b/src/Entity/ProxyData.php
index 55277ac..7289c70 100644
--- a/src/Entity/ProxyData.php
+++ b/src/Entity/ProxyData.php
@@ -12,6 +12,7 @@ use Symfony\Component\Serializer\Annotation\Groups;
  * @ApiResource(
  *     collectionOperations={
  *         "post" = {
+ *             "security" = "is_granted('IS_AUTHENTICATED_FULLY') and is_granted('ROLE_SCOPE_API-PROXY')",
  *             "path" = "/proxy/proxydata",
  *             "openapi_context" = {
  *                 "tags" = {"Proxy"},
@@ -25,6 +26,7 @@ use Symfony\Component\Serializer\Annotation\Groups;
  *             }
  *         },
  *         "get" = {
+ *             "security" = "is_granted('IS_AUTHENTICATED_FULLY') and is_granted('ROLE_SCOPE_API-PROXY')",
  *             "path" = "/proxy/proxydata",
  *             "openapi_context" = {
  *                 "tags" = {"Proxy"},
@@ -33,6 +35,7 @@ use Symfony\Component\Serializer\Annotation\Groups;
  *     },
  *     itemOperations={
  *         "get" = {
+ *             "security" = "is_granted('IS_AUTHENTICATED_FULLY') and is_granted('ROLE_SCOPE_API-PROXY')",
  *             "path" = "/proxy/proxydata/{identifier}",
  *             "openapi_context" = {
  *                 "tags" = {"Proxy"}
-- 
GitLab