mirror of
https://github.com/retailcrm/NelmioApiDocBundle.git
synced 2025-02-02 15:51:48 +03:00
remove JmsSecurityExtraHandler
This commit is contained in:
parent
636eeb7cae
commit
3ef60f2926
@ -1,33 +0,0 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the NelmioApiDocBundle.
|
||||
*
|
||||
* (c) Nelmio <hello@nelm.io>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Nelmio\ApiDocBundle\Extractor\Handler;
|
||||
|
||||
use JMS\SecurityExtraBundle\Annotation\PreAuthorize;
|
||||
use JMS\SecurityExtraBundle\Annotation\Secure;
|
||||
use Nelmio\ApiDocBundle\Annotation\ApiDoc;
|
||||
use Nelmio\ApiDocBundle\Extractor\HandlerInterface;
|
||||
use Symfony\Component\Routing\Route;
|
||||
|
||||
class JmsSecurityExtraHandler implements HandlerInterface
|
||||
{
|
||||
public function handle(ApiDoc $annotation, array $annotations, Route $route, \ReflectionMethod $method): void
|
||||
{
|
||||
foreach ($annotations as $annot) {
|
||||
if ($annot instanceof PreAuthorize) {
|
||||
$annotation->setAuthentication(true);
|
||||
} elseif ($annot instanceof Secure) {
|
||||
$annotation->setAuthentication(true);
|
||||
$annotation->setAuthenticationRoles(is_array($annot->roles) ? $annot->roles : explode(',', $annot->roles));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -9,7 +9,6 @@
|
||||
<parameter key="nelmio_api_doc.twig.extension.extra_markdown.class">Nelmio\ApiDocBundle\Twig\Extension\MarkdownExtension</parameter>
|
||||
<parameter key="nelmio_api_doc.doc_comment_extractor.class">Nelmio\ApiDocBundle\Util\DocCommentExtractor</parameter>
|
||||
|
||||
<parameter key="nelmio_api_doc.extractor.handler.jms_security.class">Nelmio\ApiDocBundle\Extractor\Handler\JmsSecurityExtraHandler</parameter>
|
||||
<parameter key="nelmio_api_doc.extractor.handler.phpdoc.class">Nelmio\ApiDocBundle\Extractor\Handler\PhpDocHandler</parameter>
|
||||
|
||||
<parameter key="nelmio_api_doc.parser.collection_parser.class">Nelmio\ApiDocBundle\Parser\CollectionParser</parameter>
|
||||
@ -42,10 +41,6 @@
|
||||
|
||||
<!-- Extractor Annotation Handlers -->
|
||||
|
||||
<service id="nelmio_api_doc.extractor.handler.jms_security" class="%nelmio_api_doc.extractor.handler.jms_security.class%" public="false">
|
||||
<tag name="nelmio_api_doc.extractor.handler"/>
|
||||
</service>
|
||||
|
||||
<service id="nelmio_api_doc.extractor.handler.phpdoc" class="%nelmio_api_doc.extractor.handler.phpdoc.class%" public="false">
|
||||
<argument type="service" id="nelmio_api_doc.doc_comment_extractor" />
|
||||
<tag name="nelmio_api_doc.extractor.handler"/>
|
||||
|
Loading…
x
Reference in New Issue
Block a user