簡體   English   中英

Silex中的WebProfiler不顯示用戶

[英]WebProfiler in Silex doesn't show user

我已經在Silex應用程序中集成了silex/web-profiler

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

並配置了帶有表單身份驗證的示例防火牆:

// 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();

我可以使用示例admin帳戶登錄並在控制器中訪問用戶,但WebProfiler不會顯示用戶標簽:

在此處輸入圖片說明

是否應該額外配置?

似乎為了在Web調試工具欄中顯示帶有用戶信息的安全面板,您還需要安裝安全捆綁包SecurityDataCollector類所在的地方 )。

因此,您只需要執行:

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

這樣就足夠了。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM