Edit: My issue was resolved, see at the bottom of the post.
i’ve been trying to connect to a LDAP with Symfony 3.4 and i’m having quite troubles here.
i’ve setup my services.yml and security.yml following the documentation at https://symfony.com/doc/3.4/components/ldap.html and https://symfony.com/doc/3.4/security/ldap.html and also https://symfony.com/doc/3.4/reference/configuration/security.html
Here is my services.yaml
services: SymfonyComponentLdapLdap: arguments: ['@SymfonyComponentLdapAdapterExtLdapAdapter'] SymfonyComponentLdapAdapterExtLdapAdapter: arguments: - host: myaddress port: 389 #encryption: tls options: protocol_version: 3 referrals: false
And here is my security.yaml
security: providers: my_ldap: ldap: service: SymfonyComponentLdapLdap base_dn: dc=corp,dc=com search_dn: "dc=corp,dc=com" search_password: password default_roles: ROLE_USER uid_key: uid firewalls: dev: pattern: ^/(_(profiler|wdt)|css|images|js)/ security: false main: pattern: ^/ provider: my_ldap anonymous: true form_login_ldap: login_path: login check_path: login service: SymfonyComponentLdapLdap dn_string: 'uid={username},ou=People,dc=corp,dc=com' logout_on_user_change: true logout: path: logout target: login role_hierarchy: ROLE_ADMIN: ROLE_MANAGER ROLE_MANAGER: ROLE_USER - { path: ^/admin, roles: ROLE_ADMIN } - { path: ^/manager, roles: ROLE_MANAGER } - { path: ^/myaccount, roles: ROLE_USER } - { path: ^/, roles: IS_AUTHENTICATED_ANONYMOUSLY }
I don’t know why the dependency isn’t found. I’ve checked the Ldap package with composer and everything was there. What am i missing ?
Thanks by advance for any clue or answer.
Edit: I managed to resolved my error. My service.yaml syntax was wrong i used:
SymfonyComponentLdapLdap: arguments: ['@SymfonyComponentLdapAdapterExtLdapAdapter'] SymfonyComponentLdapAdapterExtLdapAdapter: arguments: #...
Where it should’ve been:
SymfonyComponentLdapLdap: arguments: ['@SymfonyComponentLdapAdapterExtLdapAdapter'] SymfonyComponentLdapAdapterExtLdapAdapter: arguments:
The tabulation for the second service was baddly made.
Advertisement
Answer
Syntax of services.yaml was wrong: one indentation was misplaced