Guest User

Untitled

a guest
Dec 18th, 2017
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.22 KB | None | 0 0
  1. $app->register(new SilexProviderSecurityServiceProvider());
  2. $app['security.firewalls'] = array(
  3. 'chat' => array(
  4. 'pattern'=>'/chat',
  5. 'anonymous'=>false,
  6. //login_path: before authorisation Check_path: path to check the date of the user
  7. 'form'=>array('login_path'=>'/login','check_path' => '/chat/login_check'),
  8. //should realizise the logout
  9. 'logout'=>array('logout_path'=>'/chat/logout','target_url'=>'/logout'),
  10. 'users'=> $app->share(function() use ($app){
  11. return new resourcescontrollerUserProvider($app['db']);
  12. })
  13. )
  14. );
  15.  
  16. 'invalidate_session'=>false
  17.  
  18. 'invalidate_session'=>true
  19.  
  20. $app->extend('security.firewall', function($firewall, $app) {
  21. static $initialized = false;
  22. if ($initialized) return $firewall;
  23. $initialized = true;
  24.  
  25. // logout handlers
  26. $app['security.authentication_listener.administration.logout']->addHandler(
  27. new MyLogoutLogoutHandler()
  28. );
  29.  
  30. return $firewall;
  31. });
  32.  
  33. class LogoutHandler implements LogoutHandlerInterface
  34. {
  35. public function logout(Request $request, Response $response, TokenInterface $token)
  36. {
  37. $user = $token->getUser();
  38. }
  39. }
Add Comment
Please, Sign In to add comment