Reputation: 3011
Im using Symfony 5.0.5. This webapp have a backoffice for admins and other customer backoffice or customer informations for "customers"
Im have multiple login routes onto my app. Im trying to implemente multiple logout router because I need check or make some actions on each case
security.yaml
firewalls:
dev:
pattern: ^/(_(profiler|wdt)|css|images|js)/
security: false
main:
anonymous: lazy
account.yaml
account_logout:
path: logout/comom
controller: App\Controller\Security\SecurityController::logout
methods: [GET]
account_customer_logout:
path: logout/customer
controller: App\Controller\Security\SecurityController::logoutCustomer
methods: [GET]
SecurityController.php
public function logout()
{
$this->get('security.token_storage')->setToken(null);
$this->get('session')->invalidate();
// some stuff
return new RedirectResponse($this->generateUrl("account_login"));
}
public function logoutCustomer()
{
$this->get('security.token_storage')->setToken(null);
$this->get('session')->invalidate();
// some stuff
return new RedirectResponse($this->generateUrl("login_customer"));
}
Any advice?
Upvotes: 0
Views: 896
Reputation: 3011
I found!!
just change anonymous to true
firewalls:
dev:
pattern: ^/(_(profiler|wdt)|css|images|js)/
security: false
main:
anonymous: true
Upvotes: 1