多个防火墙Symfony2

时间:2015-02-18 15:51:47

标签: php symfony

我有一个注册表单和登录表单。两者都可以选择通过Facebook登录。我不知道为什么但是出于某种原因,当我点击用Facebook注册时,它会重定向到facebook uri的登录...

security.yml:

security:

    providers:
        my_custom_hwi_provider:
            id: premium.user_provider_service

    encoders:
            Bookboon\Premium\AppBundle\Entity\User:
                algorithm: bcrypt
                cost: 12

    firewalls:
        dev:
            pattern: ^/(_(profiler|wdt)|css|images|js)/
            security: false

        main:
            anonymous: ~
            pattern: ^/login/
            form_login:
                login_path:     /login
                check_path:     /login/check
                target_path_parameter: /library
            logout:
                 path:   /logout
                 target: /
            oauth:
                resource_owners:
                    facebook:           facebook_login
                    linkedin:           linkedin_login
                    #facebook1:          facebook_sign_up
                    #linkedin1:          linkedin_sign_up
                login_path:             login_
                check_path:             login_check
                use_forward:            false
                failure_path:           login_
                oauth_user_provider:
                    service: premium.user_provider_service

        signup:
            anonymous: ~
            pattern: ^/signup/
            oauth:
                resource_owners:
                    facebook:           FB_sign_up
                    linkedin:           LI_sign_up
                login_path:             sign_up
                check_path:             sign_up_check
                use_forward:            false
                failure_path:           sign_up
                oauth_user_provider:
                    service: premium.signup_user_provider_service



    access_control:
        - { path: ^/$, roles: IS_AUTHENTICATED_ANONYMOUSLY }
        - { path: ^/home/.*, roles: IS_AUTHENTICATED_ANONYMOUSLY }
        - { path: ^/discover$, roles: IS_AUTHENTICATED_ANONYMOUSLY }
        - { path: ^/category/.*, roles: IS_AUTHENTICATED_ANONYMOUSLY }
        - { path: ^/book/.*, roles: IS_AUTHENTICATED_ANONYMOUSLY }
        - { path: ^/login.*, roles: IS_AUTHENTICATED_ANONYMOUSLY }
        - { path: ^/signup.*, roles: IS_AUTHENTICATED_ANONYMOUSLY }
        - { path: ^/register, roles: IS_AUTHENTICATED_ANONYMOUSLY }
        - { path: ^/.*, roles: ROLE_USER }
        -

config.yml:

hwi_oauth:

    firewall_name:              main

    http_client:
            verify_peer:        false # Will need to come out in production.

    resource_owners:

        facebook:
            type:               facebook
            client_id:          xxxx
            client_secret:      xxxx
            scope:              "email"

        linkedin:
            type:               linkedin
            client_id:          xxx
            client_secret:      xxx
            scope:              "r_basicprofile,r_emailaddress"


    firewall_name:              signup

    resource_owners:

        facebook:
             type:              facebook
             client_id:         xxx
             client_secret:     xxx
             scope:             "email"

        linkedin:
            type:               linkedin
            client_id:          xxx
            client_secret:      xxx
            scope:              "r_basicprofile,r_emailaddress"

0 个答案:

没有答案