Search code examples
symfonyoauth-2.0fosuserbundlehwioauthbundle

Symfony - OAuth and basic auth together


So, I have this security:

providers:
    fos_userbundle:
        id: hwi_oauth.user.provider.fosub_bridge

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

    main:
        pattern:    ^/
        anonymous: true
        logout: true
        form_login:
            provider: fos_userbundle
            csrf_provider: form.csrf_provider
            login_path: /login
            check_path: /login_check
        oauth:
            resource_owners:
                battlenet:           "/login/check-battle-net"
            login_path:        /login
            use_forward:       false
            failure_path:      /login

            oauth_user_provider:
                service: hwi_oauth.user.provider.fosub_bridge

        logout:
            path:   /logout
            target: /

        remember_me:
            key: "%secret%"
            lifetime: 31536000 # 365 days in seconds
            path: /
            domain: ~ # Defaults to the current domain from $_SERVER

and Im using HWIOauth bundle. Now I want to implement classic loggin from fos user bundle near this. Is there some simple way? ;)


Solution

  • ok, it was simple... just from console:

    app/console fos:user:create

    then make a route, form and view etc. for FOSUserBundle\SecurityController::loginAction and..

    thats it ;) its working very well, without any change to security.yml