My application has 2 security firewalls
"admin" - used by internal staff
"account" - used by customers.
Previoly I had one action under the account firewall, the action in the controller looks something like this.
$user = //get user somehow $token = new UsernamePasswordToken($user, null, 'account', $user->getRoles()); $this->get('security.token_storage')->setToken($token);
With this code above, I was able to "login as" different users, and this was working but not exactly what I wanted.
However, when I move this code to an action inside my the admin firewall, it is instead changing the token for the admin firewall, but I still want it to change the token for the account firewall, is this possible? (In other words, I only want admin users to have the ability to login as different account users)
I would rather not share the "context" between the firewalls, as I would like someone to be able to be logged into the admin and the account firewalls at the same time.