I have Silex installation with this SecurityServiceProvider
setup:
$this->app->register(new SecurityServiceProvider(), array(
'security.firewalls' => array(
'login' => array(
'pattern' => '^/login$',
),
'secured' => [
'pattern' => '^/admin.*$',
'anonymous' => true,
'form' => array(
'login_path' => '/login',
'check_path' => '/admin/auth'
),
'logout' => array(
'logout_path' => '/admin/logout'
),
'users' => $this->app->share(function() use ($self) {
return new AuthenticationSuccessHandler($self->app['db']);
}),
]
),
'security.role_hierarchy' => [
'ROLE_USER' => [],
'ROLE_BACKEND_USER' => ['ROLE_USER'],
'ROLE_SUPERADMIN' => $this->getAllBasicRoleName()
],
'security.access_rules' => array(
['^/.*$', 'ROLE_USER'],
['^/admin.*$', 'ROLE_SUPERADMIN'],
['^/admin.*$', 'ROLE_BACKEND_USER']
)
));
This setup resolve:
/login -> login form
/admin -> secure area
/admin/logout -> logout form
But I need login form to be reachable under admin path like this:
/admin/login -> login form UNDER ADMIN PATH!
/admin -> secure area
/admin/logout -> logout form
There is a way to do this?
Thanks. S.
Have you tried changing: 'login_path' => '/login',
to 'login_path' => '/admin/login',
?
I think you will also want to change 'pattern'=> '^/login$',
to 'pattern'=> /admin(.*)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.