Support AJAX login and logout

Currently, if we want to support AJAX login and logout, we can only modify the return result by authentication handler. Each firewall section can only have one success_handler and failure_handler, and so the logic has to be resided here.