hslavich / OneloginSamlBundle

OneLogin SAML Bundle for Symfony
MIT License
149 stars 94 forks source link

Listener method mismatch when using a UserFactory #176

Closed alafon closed 3 years ago

alafon commented 3 years ago

The user factory is by default trying to execute onSamluserCreated and onSamluserModified which are not available in the default classes UserCreatedListener and UserModifiedListener

See the error (on 1.6.2 and Sf 3.4):

Warning: call_user_func() expects parameter 1 to be a valid callback, class 'Hslavich\OneloginSamlBundle\EventListener\User\UserCreatedListener' does not have a method 'onSamluserCreated'

What would you prefer ? Renaming the method or changing the listener definition like this:

    hslavich_onelogin_saml.user_created_listener:
        class: Hslavich\OneloginSamlBundle\EventListener\User\UserCreatedListener
        arguments: [""]
        tags:
            - { name: kernel.event_listener, event: saml_user.created, method: onUserCreated }
            - { name: hslavich.saml_user_listener }

    hslavich_onelogin_saml.user_modified_listener:
        class: Hslavich\OneloginSamlBundle\EventListener\User\UserModifiedListener
        arguments: [""]
        tags:
            - { name: kernel.event_listener, event: saml_user.modified, method: onUserModified }
            - { name: hslavich.saml_user_listener }

Basically, adding the method attribute on the listener tags.

a-menshchikov commented 3 years ago

@alafon thank you. I changed the listener definition in 1.x, test it please. If all right I will release it and close this issue.

alafon commented 3 years ago

:+1: works like a charm. Thanks