Reputation: 641
i have a onKernelResponse listener. in my code i want to know if the user request a firewalled url or not. I want to set my var $isRequestToAProtectedUrl
...
if( $isAjaxRequest && !$isAuthenticated && $isRequestToAProtectedUrl){
$this->container->get("session")->invalidate();
header('NOT_AUTHORIZED: 499'); //modifiy header(must be catch in client)
exit();
}
...
thanks in advance
Upvotes: 0
Views: 57
Reputation: 3260
Symfony2 Security solves authentication and authorization for you. It seems you need to create custom AccessDeniedHandler. There is a nice example here:
Using Symfony2's AccessDeniedHandlerInterface
Upvotes: 1