lightSAML / SpBundle

SAML2 SP Symfony Bundle based on LightSAML
https://www.lightsaml.com/SP-Bundle/
MIT License
66 stars 70 forks source link

Custom user_checker ignored #49

Open JulienMarliac opened 7 years ago

JulienMarliac commented 7 years ago

Hi, I 'm trying to define a custom user_checker by doing :

saml:
            context: app
            pattern:             /saml(.*)
            user_checker: my_custom_user_checker
            ...

But the user_checker is ignored and the default one is used which I don't want.

The only way i have found so far is to override the following service in my app :

security.authentication.provider.lightsaml_sp:
        class: LightSaml\SpBundle\Security\Authentication\Provider\LightsSamlSpAuthenticationProvider
        arguments:
            - ~ # provider key
            - ~ # user provider
            - ~ # force
            - "@my_custom_user_checker"
            - "@lightsaml_sp.username_mapper.simple" # username mapper
            - ~ # user creator
            - "@lightsaml_sp.attribute_mapper.simple" # attribute mapper
            - ~ # token factory
        abstract: true

I m not sure if this is a bug or not but I think the bundle should take the 'user_checker' parameter (if given) instead of using the default one.

Tony-Esales commented 6 years ago

I'm experiencing the same issue. The workaround I found was to override the Symfony default user_checker config. In my services.yaml I add:

security.user_checker: class: App\Security\MyOwnClass

It's not a problem for me at all, but it should get the user_checker from the firewall config that it's being exeuted.