Created
September 18, 2017 06:05
-
-
Save MaximStrutinskiy/d07112c8920c7d80a0436b242c1e0fe8 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$app->register(new Silex\Provider\SecurityServiceProvider(), | |
[ | |
$app['security.firewalls'] = [ | |
'secured' => [ | |
'pattern' => '^/', | |
'anonymous' => true, | |
'form' => [ | |
'login_path' => '/login', | |
'check_path' => '/admin/login_check', | |
], | |
'logout' => [ | |
'logout_path' => '/admin/logout', | |
'invalidate_session' => true, | |
], | |
'users' => function () use ($app) { | |
return $app['user_repository']; | |
} | |
], | |
], | |
$app['security.role_hierarchy'] = [ | |
'ROLE_ADMIN' => [ | |
'ROLE_USER', | |
'ROLE_ALLOWED_TO_SWITCH', | |
], | |
], | |
$app['security.access_rules'] = [ | |
['^/$', 'IS_AUTHENTICATED_ANONYMOUSLY'], | |
['^/admin', 'ROLE_ADMIN'], | |
], | |
] | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment