简体   繁体   中英

Symfony2 FR3DLdapBundle and FOSUserBundle insert in database

I joined the identifiaction LDAP fos. The identification works well but fosuser add my user in the database. I wish I disable the insert in the database. Also, if I try to reconnect, it tries to reintegrate the user.

How to disable fos_user_security_check? Or deactivate the check of fosuser.

Thanks for your help.

Here my conf

security.yml

security:
    providers:
        chain_provider:
            chain:
                providers: [fos_userbundle, fr3d_ldapbundle]
        fr3d_ldapbundle:
            id: fr3d_ldap.security.user.provider
        fos_userbundle:
            id: fos_user.user_manager

    firewalls:
        dev:
            pattern: ^/(_(profiler|wdt)|css|images|js)/
            security: false
        main:
            pattern: ^/
            fr3d_ldap:  ~
            form_login:
                always_use_default_target_path: true
                default_target_path: /
            logout:     true
            anonymous:  true
        default:
            anonymous: ~
    encoders:
        Pnrv\Bundle\UserBundle\Entity\User: plaintext

config.yml

fos_user:
    db_driver: orm 
    firewall_name: main
    user_class: Pnrv\Bundle\UserBundle\Entity\User
fr3d_ldap:
    driver:
        host:         myhost
    user:
        baseDn: ou=users, dc=name,dc=int
        filter: (&(ObjectClass=Person))
        attributes:          
           - { ldap_attr: uid,  user_method: setUsername } # Default
           - { ldap_attr: mail,   user_method: setEmail }     # Optional
           - { ldap_attr: givenname,   user_method: setName }     # Optional

For avoid persist the user object in database just remove the fos_userbundle from the chain_provider

FR3DLdapBundle will create the user object on the fly in each authentication attemp.

Finally I have not disable fosuser, I finally managed to get the two bundle. Thank you for the answer. If you want to know how I did it: Integration example

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM