HWIOAuthBundle icon indicating copy to clipboard operation
HWIOAuthBundle copied to clipboard

Has EntityUserProvider ever worked?

Open lobodol opened this issue 7 months ago • 1 comments

Q A
Bug? yes
New Feature? no
Support question? yes
Version 2.x

Actual Behavior

Too few arguments to function HWI\Bundle\OAuthBundle\Security\Core\User\EntityUserProvider::__construct(), 1 passed in /var/www/myapp/current/var/cache/dev/ContainerEHdpG4W/getSecurity_Authenticator_Oauth_MainService.php on line 47 and at least 3 expected

Expected Behavior

No error on instantiation of HWI\Bundle\OAuthBundle\Security\Core\User\EntityUserProvider

Steps to Reproduce

Follow the documentation and use the provided service hwi_oauth.user.provider.entity as oauth_user_provider:

# config/security.yaml
security:
    enable_authenticator_manager: true

    firewalls:
        dev:
            pattern: ^/(_(profiler|wdt)|css|images|js)/
            security: false
        main:
            pattern: ^/
            oauth:
                resource_owners:
                    facebook:           "/login/check-facebook"
                    google:             "/login/check-google"
                login_path:   /login
                use_forward:  false
                failure_path: /login
                oauth_user_provider:
                    service: hwi_oauth.user.provider.entity

Possible Solutions

I think the problem comes from hwi/oauth-bundle/src/Resources/config/oauth.php where only 1 argument is passed to the constructor whereas 3 are expected:

    $services->set('hwi_oauth.user.provider.entity', EntityUserProvider::class)
        ->args([service('doctrine')]);

I would expect something like this:

    $services->set('hwi_oauth.user.provider.entity', EntityUserProvider::class)
        ->args([
                service('doctrine'),
                param('the_name_of_my_user_model'),
                param('I dont really understand this one yet'),
        ]);

This leads me to this question: has this provider ever worked?

lobodol avatar Nov 14 '23 21:11 lobodol

I would say, yes it worked, but required manual setup anyway... i.e. this works:

services:
    hwi_oauth.user.provider.entity:
        class: HWI\Bundle\OAuthBundle\Security\Core\User\EntityUserProvider
        arguments:
            $class: App\Entity\User
            $properties:
                'facebook': 'facebook'
                'google': 'google'

stloyd avatar Feb 16 '24 17:02 stloyd