Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/symfony/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Symfony2 FOSUserBundle身份验证_Symfony - Fatal编程技术网

Symfony2 FOSUserBundle身份验证

Symfony2 FOSUserBundle身份验证,symfony,Symfony,我刚刚配置了Symfony2的FOSUserBundle包,我有一个问题要问 下面的一些URL允许每个人访问配置页面。我如何将此限制为仅管理员 例如,在没有管理员登录的情况下,访客/会员不应看到下面的页面 http://localhost/fosuser/web/app_dev.php/_profiler/search_bar 我使用终端运行了以下命令:php应用程序/控制台路由器:debug _wdt ANY ANY ANY /_wdt/{token} _profiler_home ANY

我刚刚配置了Symfony2的FOSUserBundle包,我有一个问题要问

下面的一些URL允许每个人访问配置页面。我如何将此限制为仅管理员

例如,在没有管理员登录的情况下,访客/会员不应看到下面的页面

http://localhost/fosuser/web/app_dev.php/_profiler/search_bar
我使用终端运行了以下命令:
php应用程序/控制台路由器:debug

_wdt ANY ANY ANY /_wdt/{token}
_profiler_home ANY ANY ANY /_profiler/
_profiler_search ANY ANY ANY /_profiler/search
_profiler_search_bar ANY ANY ANY /_profiler/search_bar
_profiler_purge ANY ANY ANY /_profiler/purge
_profiler_info ANY ANY ANY /_profiler/info/{about}
_profiler_phpinfo ANY ANY ANY /_profiler/phpinfo
_profiler_search_results ANY ANY ANY /_profiler/{token}/search/results
_profiler ANY ANY ANY /_profiler/{token}
_profiler_router ANY ANY ANY /_profiler/{token}/router
_profiler_exception ANY ANY ANY /_profiler/{token}/exception
_profiler_exception_css ANY ANY ANY /_profiler/{token}/exception.css
_configurator_home ANY ANY ANY /_configurator/
_configurator_step ANY ANY ANY /_configurator/step/{index}
_configurator_final ANY ANY ANY /_configurator/final
_twig_error_test ANY ANY ANY /_error/{code}.{_format}
user ANY ANY ANY /user/
user_show ANY ANY ANY /user/{id}/show
user_new ANY ANY ANY /user/new
user_create POST ANY ANY /user/create
user_edit ANY ANY ANY /user/{id}/edit
user_update POST|PUT ANY ANY /user/{id}/update
user_delete POST|DELETE ANY ANY /user/{id}/delete
custom_user_homepage ANY ANY ANY /hello/{name}
homepage ANY ANY ANY /app/example

默认情况下,在symfony中,所有的
\u profiler
URL都在
dev
防火墙中以模式
^/((profiler(profiler | wdt | error)| css | images | js)/
进行管理,您可以在
app/config/security.yml
文件中看到这一点。正如您将看到的,它们没有关联的安全性。这是正常的,因为它们在生产中不可访问

但是,如果您仍然需要检查这些URL,请随时向该防火墙添加一些安全配置,记住这也会影响其他匹配的URL,例如
\u error
css
,因此您可能需要为
\u profiler
路由创建一个新的特定防火墙