Reputation: 1
I am currently trying to implement an LDAP authentication using the Symfony built-in module. I followed this tutorial : http://symfony.com/doc/current/security/ldap.html
But I can't make it work, and most of the research I have made concern Symfony 2.8 and none of this worked.
Here are my settings:
config/services.yaml
Symfony\Component\Ldap\Ldap:
arguments: ['@Symfony\Component\Ldap\Adapter\ExtLdap\Adapter']
Symfony\Component\Ldap\Adapter\ExtLdap\Adapter:
arguments:
- host: ######
port: 389
encryption: tls
options:
protocol_version: 3
referrals: false
config/packages/security.yaml
providers:
app_users:
ldap:
service: Symfony\Component\Ldap\Ldap
base_dn: 'DC=company,DC=com'
search_dn: 'CN=######,DC=company,DC=com'
search_password: '#######'
uid_key: 'sAMAccountName'
filter: '({uid_key}={username})'
default_roles: 'ROLE_USER'
firewalls:
dev:
pattern: ^/(_(profiler|wdt)|css|images|js)/
security: false
main:
anonymous: false
http_basic_ldap:
provider: app_users
service: Symfony\Component\Ldap\Ldap
dn_string: '{username}'
currently with this configuration I do have this error:
Warning: ldap_start_tls(): Unable to start TLS: Connect error
I found no workarround yet, so I tried to replace TLS by SSL in the services.yaml file (I think it does not do anything by the way).
With the SSL argument it loop me to connect.
I also use the PHP function ldap_connect() to make sure my LDAP server works and it does.
If any one has any ideas?
EDIT: using SSL the log file returns always the same issue (the credentials are correct)
[2018-01-04 13:30:36] security.INFO: Basic authentication Authorization header found for user. {"username":"#######"} []
[2018-01-04 13:30:36] php.DEBUG: Warning: ldap_bind(): Unable to bind to server: Can't contact LDAP server ...
[2018-01-04 13:30:36] security.INFO: Basic authentication failed for user. {"username":"#######","exception":"[object] (Symfony\\Component\\Security\\Core\\Exception\\BadCredentialsException(code: 0): Bad credentials. : User \"######\" not found. : Can't contact LDAP server
Happy new year and thanks in advance. AM.
Upvotes: 0
Views: 5984
Reputation: 69
I have the same problem and I just removed the encryption: tls from the arguments of "Symfony\Component\Ldap\Adapter\Ext Ldap\Adapter",
Upvotes: 0