如何在silex中正确配置多个防火墙?

时间:2017-02-23 07:22:01

标签: php symfony silex

我正在开发一个项目,我希望有两个登录表单,一个用于系统的管理区域,另一个用于访问客户端,我已经配置了以下防火墙

'admin'       =>  array(
    'pattern'   =>  '^/.*$',
    'anonymous' =>  true,
    'form'      =>  array(
        'login_path' => '/',
        'check_path' => '/login_check',
        'default_target_path' => '/dashboard',
        'always_use_default_target_path' => true,
        'username_parameter' => 'username',
        'password_parameter' => 'password',
        'csrf_parameter' => 'login_token',
        'failure_path' => '/',
    ),
    'logout'    =>  array(
        'logout_path' => '/logout',
        'target' => '/'
    ),
    'users' => $app->factory(function () use ($app) {
        return new Lib\Provider\UserProvider($app);
    })
),
'clients'      =>  array(
    'pattern'   =>  '^/clients',
    'anonymous' =>  true,
    'form'      =>  array(
        'login_path' => '/clients/login',
        'check_path' => '/clients/login_check',
        'default_target_path' => '/clients/admin',
        'always_use_default_target_path' => true,
        'username_parameter' => 'username',
        'password_parameter' => 'password',
        'csrf_parameter' => 'login_token',
        'failure_path' => '/clients',
    ),
    'logout'    =>  array(
        'logout_path' => '/clients/logout',
        'target' => '/clients/login'
    ),
    'users' => $app->factory(function () use ($app) {
        return new Lib\Provider\ClientProvider($app);
    })
)

'check_path'=>管理防火墙中的'/ login_check'工作正常,但是当您想要转到客户端防火墙中check_path生成的url时,它会标记以下错误

NotFoundHttpException in HttpKernel.php line 134:    
Unable to find the controller for path "/clients/login_check". The route is wrongly configured.

我搜索了几个小时,我无法纠正这个错误,我将非常感谢你帮助解决它

谢谢

0 个答案:

没有答案