Skip to content

Instantly share code, notes, and snippets.

@Nek-
Created February 7, 2019 14:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Nek-/b9e343bb6a6dd88b2c4d27147d50b13a to your computer and use it in GitHub Desktop.
Save Nek-/b9e343bb6a6dd88b2c4d27147d50b13a to your computer and use it in GitHub Desktop.
Symfony LDAP Security config example
security:
providers:
user_provider:
ldap:
service: Symfony\Component\Ldap\Ldap
base_dn: "%env(LDAP_BASE_DN)%"
# Identifiants pour la connexion au LDAP
search_dn: "%env(LDAP_SEARCH_DN)%"
search_password: "%env(LDAP_SEARCH_PASSWORD)%"
# Rôle par défaut pour nos utilisateurs LDAP
default_roles: ROLE_USER
# Clé contenant notre identifiant unique
uid_key: uid
# Clé contenant le mot de passe
password_attribute: 'userPassword'
encoders:
Symfony\Component\Security\Core\User\User:
id: App\Security\LdapEncoder
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment