简体   繁体   English

Silex中的WebProfiler不显示用户

[英]WebProfiler in Silex doesn't show user

I've integrated silex/web-profiler in a Silex app: 我已经在Silex应用程序中集成了silex/web-profiler

"require-dev": {
    "silex/web-profiler": "^2.0"
}

and configured an example firewall with form authentication: 并配置了带有表单身份验证的示例防火墙:

// Security
$app['security.firewalls'] = array(
    'main' => array(
        'pattern' => '^/',
        'anonymous' => true,
        'form' => array('login_path' => '/login', 'check_path' => '/login_check'),
        'users' => array(
            'admin' => array('ROLE_ADMIN', '$2y$10$3i9/lVd8UOFIJ6PAMFt8gu3/r5g0qeCJvoSlLCsvMTythye19F77a'),
        ),
    )
);
$app->register(new Silex\Provider\SecurityServiceProvider(), array());

// Profiler
if ($app['debug']) {
    $app->register(new Silex\Provider\ServiceControllerServiceProvider());
    $app->register(new Provider\WebProfilerServiceProvider(), array(
        'profiler.cache_dir' => __DIR__.'/../cache/profiler',
        'profiler.mount_prefix' => '/_profiler', // this is the default
    ));
}
$app->boot();

I'm able to login with the example admin account and access the user in a controller, but the WebProfiler doesn't show the user tab: 我可以使用示例admin帐户登录并在控制器中访问用户,但WebProfiler不会显示用户标签:

在此处输入图片说明

Should it be additionally configured? 是否应该额外配置?

It seems that in order to show the security panel with the user information in the web debug toolbar you need to install also the security bundle (where the SecurityDataCollector class resides ). 似乎为了在Web调试工具栏中显示带有用户信息的安全面板,您还需要安装安全捆绑包SecurityDataCollector类所在的地方 )。

So you just need to execute: 因此,您只需要执行:

composer require --dev symfony/security-bundle 作曲家需要--dev symfony / security-bundle

And that should be enough. 这样就足够了。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM