2011-11-15 55 views
1

我可以在access_control安全配置中使用路由嗎? 在安全配置中沒有關於使用路由的任何信息。 我不想在routing.yml和security.yml中支持兩個類似的URL路徑定義。我只想定義一個新的路由並將其名稱提供給安全access_control部分。 這可能嗎?我可以在access_control安全配置中使用路由嗎?

+0

你到底要與路線做些什麼? –

+0

我只想在路由配置中存儲URL生成信息,並在防火牆中使用它。 –

回答

0

沒有辦法做到這一點。

指定的path作爲RequestMatcher$path參數直接傳遞。

訪問映射項臨時用戶到訪問地圖位置: 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

如果你在RequestMatcher的代碼來看看,你看它沒有連接到任何路由系統: https://github.com/symfony/symfony/blob/master/src/Symfony/Component/HttpFoundation/RequestMatcher.php

+0

實際上看看這個http://stackoverflow.com/questions/17661249/symfony2-access-control-with-routes – gondo

相關問題