Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $app->register(new SilexProviderSecurityServiceProvider());
- $app['security.firewalls'] = array(
- 'chat' => array(
- 'pattern'=>'/chat',
- 'anonymous'=>false,
- //login_path: before authorisation Check_path: path to check the date of the user
- 'form'=>array('login_path'=>'/login','check_path' => '/chat/login_check'),
- //should realizise the logout
- 'logout'=>array('logout_path'=>'/chat/logout','target_url'=>'/logout'),
- 'users'=> $app->share(function() use ($app){
- return new resourcescontrollerUserProvider($app['db']);
- })
- )
- );
- 'invalidate_session'=>false
- 'invalidate_session'=>true
- $app->extend('security.firewall', function($firewall, $app) {
- static $initialized = false;
- if ($initialized) return $firewall;
- $initialized = true;
- // logout handlers
- $app['security.authentication_listener.administration.logout']->addHandler(
- new MyLogoutLogoutHandler()
- );
- return $firewall;
- });
- class LogoutHandler implements LogoutHandlerInterface
- {
- public function logout(Request $request, Response $response, TokenInterface $token)
- {
- $user = $token->getUser();
- }
- }
Add Comment
Please, Sign In to add comment