我想在注销后更改用户的状态。但我不知道如何做到这一点。
$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;
});
LogoutHandler 应该实现LogoutHandlerInterface
class LogoutHandler implements LogoutHandlerInterface
{
public function logout(Request $request, Response $response, TokenInterface $token)
{
$user = $token->getUser();
}
}