We have a double problem here
We've developed a percent of our app Customer has changed requirement about login. So we need to authentica via ldap againsta an active directory
We'd like so to use both Backpack For Laravel and LdapRecord For Laravel
Do you know if is it possible at all?
Actually, we 'are using database integration
Our user class it's this
<?php
namespace App\Models;
use Backpack\CRUD\app\Models\Traits\CrudTrait;
use Illuminate\Contracts\Auth\MustVerifyEmail;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Foundation\Auth\User as Authenticatable;
use Illuminate\Notifications\Notifiable;
use Spatie\Permission\Traits\HasRoles;
use LdapRecord\Laravel\Auth\LdapAuthenticatable;
use LdapRecord\Laravel\Auth\AuthenticatesWithLdap;
class User extends Authenticatable implements LdapAuthenticatable
{
use HasFactory, Notifiable;
use HasRoles;
use CrudTrait;
use AuthenticatesWithLdap;
/**
* The attributes that are mass assignable.
*
* @var array
*/
protected $fillable = [
'name',
'email',
'password',
];
/**
* The attributes that should be hidden for arrays.
*
* @var array
*/
protected $hidden = [
'password',
'remember_token',
];
/**
* The attributes that should be cast to native types.
*
* @var array
*/
protected $casts = [
'email_verified_at' => 'datetime',
];
}
We have set config.backpack.base.user_model_fqn
as App\Models\User::class
And config.auth.providers
is configure as follow:
'providers' => [
// https://ldaprecord.com/docs/laravel/v2/auth/database/configuration#introduction
'users' => [
'driver' => 'ldap',
'model' => LdapRecord\Models\ActiveDirectory\User::class,
'rules' => [],
'database' => [
'model' => App\User::class,
'sync_passwords' => false,
'sync_attributes' => [
'name' => 'cn',
'email' => 'mail',
],
'sync_existing' => [
'email' => 'mail',
],
],
],
],
I got every time the error: "These credentials do not match our records."
I'm sure of username because I've choosen it in the AD domain controller