hwi / HWIOAuthBundle

OAuth client integration for Symfony. Supports both OAuth1.0a and OAuth2.
MIT License
2.27k stars 799 forks source link

The check_path "/login_check" for login method "oauth" is not matched by the firewall pattern "^/demo/secured/". #884

Closed NadjibBELLOUNDJA closed 3 years ago

NadjibBELLOUNDJA commented 9 years ago

Hi, I have been having this issue for some hours now. Adding the login_check pattern to my main_facebook_firewall solves the issues, but raises another one, which is explained below: I have one main_facebook_firewall for authentication via facebook and one main_firewall for classi authentication via email. main_facebook_firewall comes before main_firewall in my security.yml. If I add the login_check pattern to my main_facebook_firewall, it will prevent the main_firewall from intercepting the pattern login_check and will cause all classic authentications to fail.

So here goes my codes

confing.yml

hwi_oauth:
    firewall_name: main_facebook_firewall
    resource_owners:
        facebook:
            type:                facebook
            client_id:           xxxxxxx
            client_secret:       xxxxxx
            scope:         "email"
            options:
                display: popup
services:
    hwi_oauth.user.provider.entity:
        class: HWI\Bundle\OAuthBundle\Security\Core\User\OAuthUserProvider

security.yml:

        main_facebook_firewall:
            anonymous: ~
            pattern:    ^/(demo/secured/|login_check)
            oauth:
                resource_owners:
                    facebook:      /demo/secured/login_facebook
                login_path:        /demo/secured/login
                failure_path:      /demo/secured/login
                oauth_user_provider:
                    service: hwi_oauth.user.provider.entity
            context: general_context

        main_firewall:
            pattern: /
            anonymous: false
            provider: main_provider
            context: general_context
            form_login:
                login_path: /platform/home
                check_path: /login_check
                always_use_default_target_path: false
                use_forward: false
                post_only: true
                username_parameter: _username
                password_parameter: _password
                success_handler: at_member.login_handler
                require_previous_session: false
            logout:
                path: /logout
                target: /platform/home
                success_handler: at_member.logout_handler
            context: general_context

routing.yml

hwi_oauth_redirect:
    resource: "@HWIOAuthBundle/Resources/config/routing/redirect.xml"
    prefix:   /demo/secured/connect

hwi_oauth_login:
    resource: "@HWIOAuthBundle/Resources/config/routing/login.xml"
    prefix:   /demo/secured/login

facebook_login:
    path: /demo/secured/login_facebook

For my main_facebook_firewall, if I put pattern: ^/(demo/secured/|login_check), my main_firewall doesn't work anymore. And if I put pattern: ^/demo/secured/, I get the error in the title.

Can somebidy help me? Am I missing something? How to make both compatible facebook authentication and mail authentication. Thank you.

stloyd commented 3 years ago

Closing as outdated. If issue still occurs, please open new issue. Thank you.

fahimbinkhair commented 2 years ago

I am having the same problem, any help plz