我可以在access_control安全配置中使用路由吗? 在安全配置中没有任何有关使用路由的信息。 我不想在routing.yml和security.yml中支持两种类似的URL路径定义。我只想定义一个新路由并将其名称提供给security access_control部分。 有可能吗?
答案 0 :(得分:0)
没有办法做到这一点。
指定的path
直接作为RequestMatcher
的{{1}}参数传递。
访问地图条目在此处注册到访问地图中: https://github.com/symfony/symfony/blob/master/src/Symfony/Bundle/SecurityBundle/DependencyInjection/SecurityExtension.php#L165-187
使用使用此方法创建的请求匹配器: https://github.com/symfony/symfony/blob/master/src/Symfony/Bundle/SecurityBundle/DependencyInjection/SecurityExtension.php#L539-561
如果您查看$path
的代码,您会发现它没有耦合到任何路由系统:
https://github.com/symfony/symfony/blob/master/src/Symfony/Component/HttpFoundation/RequestMatcher.php