2
votes

I need to authenticate a user in symfony2. The issue I am having is that my user is authenticated over a rest service. I send a login and password to this service and I receive the user and session as a response, or error.

It seems that in order to grant access to a firewall, I have to have a user provider, one that extends UserProviderInterface and requires the loadUserByUsername() method. And at some point symfony is going to do a password check in the background between the provided user and the login credentials.

How do I skip a user provider and symfony2 login check, and instead use a custom authentication provider that will authenticate properly with symfony2 security and allow me to define roles and firewalls in the security config.

In a nutshell, I want to authenticate through a rest interface, but authorize with symfony.

1
Please, specify which version of Symfony2 you are using - 2.0 or 2.1Vitalii Zurian
Sorry 2.0 at the moment.Brandon G

1 Answers

3
votes

You need to extend UserAuthenticationProvider. There you can do the calls to your rest service.

See this blog for an example.