Adldap2 / Adldap2-Laravel

LDAP Authentication & Management for Laravel
MIT License
911 stars 184 forks source link

Built from scratch, still does not authenticate. #574

Closed miikee-us closed 6 years ago

miikee-us commented 6 years ago

Description:

I was having troubles getting this to work with my existing application I have been working on. So I decided to follow the "Quick Start - From Scratch" guide with a clean install to see if that would even work. After following the guide, I'm still getting the same issue where When I attempt to login nothing happens. The page refreshes, but no error messages or anything. Is the guide missing something?

APP_DEBUG is set to True.

Steps To Reproduce:

stevebauman commented 6 years ago

Hi @dotmiikee, the best place to look for issues is inside your log files (ex. my-app\storage\logs).

Can you let me know what you see in there?

miikee-us commented 6 years ago

I'm not seeing anything in the laravel.log file for ADLDAP errors.

This is the last log, but it's not related as I changed from MSSQL to MYSQL.

`[2018-08-17 15:51:17] local.ERROR: SQLSTATE[08001]: [Microsoft][ODBC Driver 17 for SQL Server]TCP Provider: No connection could be made because the target machine actively refused it. (SQL: select from sysobjects where type = 'U' and name = migrations) {"exception":"[object] (Illuminate\Database\QueryException(code: 08001): SQLSTATE[08001]: [Microsoft][ODBC Driver 17 for SQL Server]TCP Provider: No connection could be made because the target machine actively refused it. (SQL: select from sysobjects where type = 'U' and name = migrations) at C:\inetpub\hero\vendor\laravel\framework\src\Illuminate\Database\Connection.php:664, PDOException(code: 08001): SQLSTATE[08001]: [Microsoft][ODBC Driver 17 for SQL Server]TCP Provider: No connection could be made because the target machine actively refused it. at C:\inetpub\hero\vendor\laravel\framework\src\Illuminate\Database\Connectors\Connector.php:68)

stevebauman commented 6 years ago

Hmmm, did you set the auth provider to adldap in your config/auth.php file?

miikee-us commented 6 years ago

This is what I have set in config/auth.php.

'providers' => [
    'users' => [
        'driver' => 'adldap',
        'model' => App\User::class,
   ],
stevebauman commented 6 years ago

Can you try clearing your config cache by running php artisan config:clear then log in again?

Afterwards, check the logs again. All authentication requests by Adldap2 are logged by default.

Also are you sure you're running v4.0 of Adldap2-Laravel? Just making sure.

miikee-us commented 6 years ago

First Off, thank-you for the continued help on this @stevebauman. I have made a little progress.

By typing in username@example.com I was able to authenticate. I also saw that a user record was created in the users table.

Things I noticed **

  1. If I log out and login again I get a sync error because there is a record already with the same username. [2018-08-17 20:13:40] local.ERROR: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry 'username' for key 'users_username_unique' (SQL: insert intousers(username,name,password,updated_at,created_at) values (username, LastName, Firstname,

  2. If I add @domain.com to ADLDAP_ACCOUNT_SUFFIX and only type in my username and password. It does not log me in. It only works if I type in username@domain.com into the login field.

**

stevebauman commented 6 years ago

No problem @dotmiikee! Glad to help :smile:

What database are you using that stores your users table? Postgre / MySQL / MSSQL?

miikee-us commented 6 years ago

MySQL currently.

stevebauman commented 6 years ago

That's strange, MySQL is case-insensitive by default...

Can you post your config/adldap.php and config/adldap_auth.php files with sensitive details omitted?

miikee-us commented 6 years ago

Attached with sensitive details omitted: adldap.txt adldap_auth.txt

miikee-us commented 6 years ago

@stevebauman , any other thoughts? I've continued to poke around and have not found resolution for the following two issues.

  1. ADLDAP_ACCOUNT_SUFFIX does not seem to be applying appropriately. I've also see other issues reported for this.

  2. For some reason, if a user already exists in the user's table it fails to log them in with the above SQL constraint violation. This is when I'm using MySQL.

"SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry 'MYUSERNAME' for key 'users_username_unique' (SQL: insert into users (username, name, ▶"

miikee-us commented 6 years ago

Since there are two issues in this ticket, and one of the issues has already been reported. I'm going to close this ticket and open a new issue for the issue that has not been reported.

  1. ADLDAP_ACCOUNT_SUFFIX does not seem to be applying appropriately. I've also see other issues reported for this.

    540

  2. For some reason, if a user already exists in the user's table it fails to log them in with the above SQL constraint violation. This is when I'm using MySQL.

    579