Adldap2 / Adldap2-Laravel

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

Auth::attempt fails #522

Open YannisHeine opened 6 years ago

YannisHeine commented 6 years ago

I get on Auth::attempt always false the loggins says:

[2018-04-12 14:35:42] local.INFO: User 'Yannis Heine' has been successfully found for authentication.

[2018-04-12 14:35:42] local.INFO: User 'Yannis Heine' is being imported.

[2018-04-12 14:35:42] local.INFO: User 'Yannis Heine' is being synchronized.

[2018-04-12 14:35:42] local.INFO: User 'Yannis Heine' has been successfully synchronized.

[2018-04-12 14:35:42] local.INFO: User 'Yannis Heine' is authenticating with username: 'CN=Yannis Heine,OU=User,OU=FIRMA_GMBH,OU=FIRMA,DC=intern,DC=firma,DC=de'

[2018-04-12 14:35:42] local.INFO: User 'Yannis Heine' has failed LDAP authentication.

I think the line with "is authenticating with username" is wrong, I think there should only be my username what could be wrong?

stevebauman commented 6 years ago

Hi @YannisHeine,

The default authenticating username for users is their distinguishedname shown here in the auth configuration:

https://github.com/Adldap2/Adldap2-Laravel/blob/master/src/Config/auth.php#L121-L127

'authenticate' => 'distinguishedname',

Try changing it to samaccountname or userprincipalname and let me know if you still encounter issues!

YannisHeine commented 6 years ago

Thank you for your fast answer! When i change it back to userprincipalname than there isnt any logging information and it return also false

stevebauman commented 6 years ago

No problem! :)

Can you post your config/adldap.php and config/adldap_auth.php (with sensitive details removed) files so I can see what attributes you're using for authentication?

YannisHeine commented 6 years ago

adldap_auth

adldap

additional config i use in .env

ADLDAP_CONTROLLERS=url.firma.de ADLDAP_PORT=389 ADLDAP_BASEDN=dc=intern,dc=firma,dc=de ADLDAP_ADMIN_USERNAME=user ADLDAP_ADMIN_PASSWORD=pass ADLDAP_TIMEOUT= 15 ADLDAP_ACCOUNT_SUFFIX=@firma.de

YannisHeine commented 6 years ago

Hey, Have you had the opportunity to review the configs ?

psmadrid commented 6 years ago

I had the same problem but when I changed the 'authenticate' => 'distinguishedname', to 'authenticate' => 'samaccountname', it worked perfectly.

jLopez23 commented 6 years ago

Hi, @psmadrid what would be the correct configuration since this also happens to me, please help.

jLopez23 commented 6 years ago

@YannisHeine I found the solution here Solution

mbarlund commented 5 years ago

@jLopez23 that solution worked for me too - thanks!