Clément Andraud
Clément Andraud

Reputation: 9269

Symfony check user provider

I have overriden the onAuthenticationSuccess function to do somethings if login ok.

In this function, I can get my user with : $token->getUser().

In my security.yml, I have two different providers : fos_userbundle for my application, and in_memory for admin.

How can I know if the user is using in_memory provider or not ? I need to check that because I don't want to do a special action if I tried to login with a user in_memory..

Thanks !

Upvotes: 1

Views: 214

Answers (1)

xabbuh
xabbuh

Reputation: 5881

You can check the class the user object is of. The in_memory provider uses the Symfony\Component\Security\Core\User\User class while FOSUserBundle provides its own User class (depending on the used database driver).

Upvotes: 3

Related Questions