Can I use routes in access_control security configuration?
There is no any information about using routes in security configuration.
I don’t want to support two similar definitions of URL paths in routing.yml and security.yml. I just want to define a new route and provide its name to the security access_control section.
Is it possible?
Can I use routes in access_control security configuration? There is no any information about
Share
There is no way to do this.
The specified
pathis directly passed as theRequestMatcher‘s$pathargument.The access map entries are registed into the access map here:
https://github.com/symfony/symfony/blob/master/src/Symfony/Bundle/SecurityBundle/DependencyInjection/SecurityExtension.php#L165-187
Using the request matchers created using this method:
https://github.com/symfony/symfony/blob/master/src/Symfony/Bundle/SecurityBundle/DependencyInjection/SecurityExtension.php#L539-561
And if you take a look at the
RequestMatcher‘s code, you see it’s not coupled to any routing system:https://github.com/symfony/symfony/blob/master/src/Symfony/Component/HttpFoundation/RequestMatcher.php