I am using data base authentication. My local environment has no access to the LDAP server. I though it will use the password from database to login if no connection to the LDAP server. Unfortunately, that did not happen. It keeps returning incorrect credentials validation error. I do not know if this is a bug or I am missing something.
It's working great on the server when I set the correct connection. But, wen I change the IP to incorrect one it's not using the locale credentials.
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Foundation\Auth\User as Authenticatable;
use Backpack\CRUD\app\Models\Traits\CrudTrait;
use LdapRecord\Laravel\Auth\LdapAuthenticatable;
use LdapRecord\Laravel\Auth\AuthenticatesWithLdap;
use Spatie\Permission\Traits\HasRoles;
class Admin extends Authenticatable implements LdapAuthenticatable
{
use HasFactory;
use CrudTrait, HasRoles;
use AuthenticatesWithLdap;
protected $fillable = [
'username',
'email',
'password',
];
protected $guard_name = 'admins';
}
Ldap Admin model:
<?php
namespace App\Ldap;
use LdapRecord\Models\Model;
use LdapRecord\Models\Concerns\CanAuthenticate;
class Admin extends Model
{
use CanAuthenticate;
/**
* The object classes of the LDAP model.
*/
public static array $objectClasses = ['person'];
protected string $guidKey = 'objectguid';
}
a second question please, how can I authenticate other registered non-LDAP users? documentation is saying that I can have this feature but I do not knoq how to implement it.
I am using data base authentication. My local environment has no access to the LDAP server. I though it will use the password from database to login if no connection to the LDAP server. Unfortunately, that did not happen. It keeps returning incorrect credentials validation error. I do not know if this is a bug or I am missing something. It's working great on the server when I set the correct connection. But, wen I change the IP to incorrect one it's not using the locale credentials.
config/auth.php provider
Admin model:
Ldap Admin model:
php artisan ldap:test
result: Testing LDAP connection [default]... +------------+------------+------------------------------------+----------------------------------------------------------------------------------------------------------------------+---------------+ | Connection | Successful | Username | Message | Response Time | +------------+------------+------------------------------------+----------------------------------------------------------------------------------------------------------------------+---------------+ | default | ✘ No | xxx.xxx@xxx.xxx | ldap_bind_ext(): Unable to bind to server: Can't contact LDAP server (-1). Error Code: [-1] Diagnostic Message: NULL | 5799.32ms | +------------+------------+------------------------------------+----------------------------------------------------------------------------------------------------------------------+---------------+Iam using:
a second question please, how can I authenticate other registered non-LDAP users? documentation is saying that I can have this feature but I do not knoq how to implement it.
Thanks in advance,