jotaelesalinas / laravel-adminless-ldap-auth

Authenticate users in Laravel against an adminless LDAP server
MIT License
210 stars 33 forks source link

password is secret - ldap_bind(): Unable to bind to server #42

Open ken-colvin opened 4 years ago

ken-colvin commented 4 years ago

When I do php artisan tinker and enter

Auth::attempt(['username' => 'einstein', 'password' => 'password'])

I am getting this error

PHP Warning: ldap_bind(): Unable to bind to server: Invalid DN syntax in vendor/adldap2/adldap2/src/Connections/Ldap.php on line 346

I am printing out the username and password and it shows as username=username, password=secret

        echo sprintf("username=%s, password=%s\n", $username, $password);
        return $this->bound = ldap_bind(
            $this->connection,
            $username,
            html_entity_decode($password)
        );

image

jotaelesalinas commented 4 years ago

Can you show us the value of config('ldap_auth.identifiers.ldap.user_format')? It should be 'uid=%s,dc=example,dc=com'. Then, the %s is replaced by the username.

ken-colvin commented 4 years ago

Do you have this working with Laravel 6? Can you show me a demo? Basically, I used the defaults in your instructions, so I would assume it should work with your instructions.

jotaelesalinas commented 4 years ago

Here you have the old instructions, no composer package, for Laravel 6: https://github.com/jotaelesalinas/laravel-adminless-ldap-auth/tree/d26ea52ddcc9a1336eb49a9c01469f51f8c83165.

Nuvelle commented 4 years ago

I am following the guide and using correct details

Auth::attempt(['username' => 'einstein', 'password' => 'password'])

and getting the same error:

>>> Auth::attempt(['username' => 'einstein', 'password' => 'password'])
PHP Warning:  ldap_bind(): Unable to bind to server: Invalid DN syntax in C:/Users/me/PhpstormProjects/project/vendor/adldap2/adldap2/src/Connections/Ldap.php on
 line 345
Adldap/Auth/BindException with message 'Invalid DN syntax'
>>>

This is using Laravel 7.16.1

jotaelesalinas commented 4 years ago

Hi @Nuvelle , did you solve the 'Invalid DN syntax' issue? What was the problem?

Nuvelle commented 4 years ago

No, this is still an issue for me - I am too new to Laravel to have any real chance at fixing it myself.

Just reporting that it is an issue in the current Laravel version for me.