dongque4778 2017-05-02 10:36
浏览 30
已采纳

Silex中的WebProfiler不显示用户

I've integrated silex/web-profiler in a Silex app:

"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:

enter image description here

Should it be additionally configured?

  • 写回答

1条回答 默认 最新

  • doubo9799 2017-05-03 06:30
    关注

    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).

    So you just need to execute:

    composer require --dev symfony/security-bundle

    And that should be enough.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥20 机器学习能否像多层线性模型一样处理嵌套数据
  • ¥20 西门子S7-Graph,S7-300,梯形图
  • ¥50 用易语言http 访问不了网页
  • ¥50 safari浏览器fetch提交数据后数据丢失问题
  • ¥15 matlab不知道怎么改,求解答!!
  • ¥15 永磁直线电机的电流环pi调不出来
  • ¥15 用stata实现聚类的代码
  • ¥15 请问paddlehub能支持移动端开发吗?在Android studio上该如何部署?
  • ¥20 docker里部署springboot项目,访问不到扬声器
  • ¥15 netty整合springboot之后自动重连失效