mirror of
https://github.com/retailcrm/NelmioApiDocBundle.git
synced 2025-02-02 15:51:48 +03:00
Update JmsSecurityExtraHandler.php
Having a JmsSecurity @PreAuthorize annotation should also count as setting a method as requiring authentication.
This commit is contained in:
parent
42f0b65a4a
commit
22508bf058
@ -11,6 +11,7 @@
|
|||||||
|
|
||||||
namespace Nelmio\ApiDocBundle\Extractor\Handler;
|
namespace Nelmio\ApiDocBundle\Extractor\Handler;
|
||||||
|
|
||||||
|
use JMS\SecurityExtraBundle\Annotation\PreAuthorize;
|
||||||
use Nelmio\ApiDocBundle\Extractor\HandlerInterface;
|
use Nelmio\ApiDocBundle\Extractor\HandlerInterface;
|
||||||
use Nelmio\ApiDocBundle\Annotation\ApiDoc;
|
use Nelmio\ApiDocBundle\Annotation\ApiDoc;
|
||||||
use Symfony\Component\Routing\Route;
|
use Symfony\Component\Routing\Route;
|
||||||
@ -21,7 +22,7 @@ class JmsSecurityExtraHandler implements HandlerInterface
|
|||||||
public function handle(ApiDoc $annotation, array $annotations, Route $route, \ReflectionMethod $method)
|
public function handle(ApiDoc $annotation, array $annotations, Route $route, \ReflectionMethod $method)
|
||||||
{
|
{
|
||||||
foreach ($annotations as $annot) {
|
foreach ($annotations as $annot) {
|
||||||
if ($annot instanceof Secure) {
|
if ($annot instanceof Secure || $annot instanceof PreAuthorize) {
|
||||||
$annotation->setAuthentication(true);
|
$annotation->setAuthentication(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user