ldaptools / ldaptools-bundle

Provides easy LDAP integration for Symfony via LdapTools.
MIT License
49 stars 29 forks source link

Multiple providers not work #49

Open Slavenin opened 6 years ago

Slavenin commented 6 years ago

Hi! my config:

ldap_tools:
    domains:
        domain:
            domain_name: ****
            username: ****
            password: *****
            base_dn: "dc=dp,dc=dom,dc=ru"
            port: 389
    security:
        user: AppBundle\Entity\User
        guard:
            failure_path: null
            failure_forward: false

security:

# To get started with security, check out the documentation:
# http://symfony.com/doc/current/security.html
security:
    hide_user_not_found:  true
    encoders:
        FOS\UserBundle\Model\UserInterface: bcrypt
    providers:
        chain_provider:
            chain:
                providers: [ldap, fos_userbundle]
        fos_userbundle:
            id: fos_user.user_provider.username_email
        ldap:
            id: ldap_tools.security.user.ldap_user_provider

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

        main:
            provider: chain_provider
            pattern: ^/
            user_checker: app.user_checker
            logout_on_user_change: true
            form_login:
                provider: chain_provider
                csrf_token_generator: security.csrf.token_manager                
                always_use_default_target_path: true
                default_target_path:            /profile

            logout:       true
            anonymous:    true
#            guard:
#                authenticators:
#                - ldap_tools.security.ldap_guard_authenticator

But if i uncomment guard section break db auth, but without this section not work ldap. How i can merge this two auth ways? PS i try use this config, but it not work

Slavenin commented 6 years ago

image

pochy-ja commented 6 years ago

I have the same problem, any updated of this issue?

m1khal3v commented 4 years ago

And I also encountered this behavior, tried for the in_memory provider

m1khal3v commented 4 years ago

For those who are interested. The problem was solved by adding a custom authenticator to the existing one from the bundle

edogomez commented 4 years ago

@aslojno i also encountered this behavior, can you show us the custom authenticator. Thanks