Adldap2 / Adldap2-Laravel

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

problem with two factor authentication #894

Closed Ryunosukee closed 4 years ago

Ryunosukee commented 4 years ago

Description:

Normal authentication works quite well, but when I try to configure the two-factor authentication that laravel 8 brings, I have a problem trying to validate the token. Captura de pantalla 2020-09-29 a la(s) 10 41 44 a  m

Thanks for your help

stevebauman commented 4 years ago

Hi @dcorrea-estrav,

I think you may have intended to post this on the LdapRecord-Laravel repository, but no worries 👍

You cannot use two-factor authentication with LdapRecord-Laravel. You must disable it inside of your config/fortify.php file in the features key.

Ryunosukee commented 4 years ago

Hi @dcorrea-estrav,

I think you may have intended to post this on the LdapRecord-Laravel repository, but no worries 👍

You cannot use two-factor authentication with LdapRecord-Laravel. You must disable it inside of your config/fortify.php file in the features key.

Thanks for your help

stevebauman commented 4 years ago

No problem @dcorrea-estrav!

I am however going to see if this is something I can implement and get working with LdapRecord-Laravel. Stay tuned for updates on the LdapRecord-Laravel repository! 👍

ivanomatteo commented 3 years ago

automatic user import do not work anyway.

/**
 * workaround for two factor auth
 */
class LaravelLdapUserProvider extends DatabaseUserProvider
{

    public function validateCredentials(Authenticatable $model, array $credentials)
    {
        if (!$this->retrieveByCredentials([
            config('fortify.username') => $model->name,
            'password' => $credentials['password'],
        ])) {
            return false;
        }
        return parent::validateCredentials($model, $credentials);
    }
}