Harold
Harold

Reputation: 699

Symfony Impersonate User and onAuthenticationSuccess

On a symfony 2 project, i have a listener on :

event: security.interactive_login, method: onAuthenticationSuccess

I have just implements the impersonate user function of symfony (2.6.6).

But when i change user, i want to pass in this listener (or find another one like onChangeUserSuccess).

Any idea?

Upvotes: 0

Views: 209

Answers (1)

Jovan Perovic
Jovan Perovic

Reputation: 20193

When impersonation is done, completely different event is fired: security.switch_user.

There is a great tutorial on how to catch that event here: http://shout.setfive.com/2013/05/16/symfony2-and-impersonating-users-a-heads-up/

You could do pretty much anything then. Few months ago I implemented it this way to explicitly prohibit impersonation some top level admin users.

Upvotes: 1

Related Questions