From 22508bf0588b7e0c17cfc00baf9182f5b58b42d2 Mon Sep 17 00:00:00 2001 From: Dave Keen Date: Mon, 29 Apr 2013 12:10:42 +0300 Subject: [PATCH] Update JmsSecurityExtraHandler.php Having a JmsSecurity @PreAuthorize annotation should also count as setting a method as requiring authentication. --- Extractor/Handler/JmsSecurityExtraHandler.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Extractor/Handler/JmsSecurityExtraHandler.php b/Extractor/Handler/JmsSecurityExtraHandler.php index 87dfdc2..4302ee5 100644 --- a/Extractor/Handler/JmsSecurityExtraHandler.php +++ b/Extractor/Handler/JmsSecurityExtraHandler.php @@ -11,6 +11,7 @@ namespace Nelmio\ApiDocBundle\Extractor\Handler; +use JMS\SecurityExtraBundle\Annotation\PreAuthorize; use Nelmio\ApiDocBundle\Extractor\HandlerInterface; use Nelmio\ApiDocBundle\Annotation\ApiDoc; use Symfony\Component\Routing\Route; @@ -21,7 +22,7 @@ class JmsSecurityExtraHandler implements HandlerInterface public function handle(ApiDoc $annotation, array $annotations, Route $route, \ReflectionMethod $method) { foreach ($annotations as $annot) { - if ($annot instanceof Secure) { + if ($annot instanceof Secure || $annot instanceof PreAuthorize) { $annotation->setAuthentication(true); } }