Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to use dual authentication with symfony2?

Tags:

symfony

Is it possible to use dual authentication with symfony2?

Users should be able to authenticate themselves with facebook and my own system.

I've read the documentation, and I know that there is the FacebookBundle with I can authenticate a user with facebook, but I don't know how to combinate the two.

like image 634
Davis Avatar asked Mar 07 '11 18:03

Davis


1 Answers

Yes. "You can configure a firewall to use more than one authentication mechanisms" : http://symfony.com/doc/current/book/security.html#using-multiple-user-providers

I didn't try it yet but I think it should be something like:

security:
    firewalls:
         public:
             pattern:   ^/.*
             form_login: true
             fos_facebook:
                 login_path: ^/facebook$
                 check_path: ^/facebook-check$
                 default_target_path: /facebook
                 provider: my_fos_facebook_provider

You can define multiple providers as well.

like image 101
Jakub Zalas Avatar answered Oct 13 '22 01:10

Jakub Zalas