Closed laTruffe79 closed 3 years ago
Hi @laTruffe79,
Can you post your config/auth.php
file?
Off course
|--------------------------------------------------------------------------
| Authentication Defaults
*/
'defaults' => [
'guard' => 'web',
'passwords' => 'users',
],
'guards' => [
'web' => [
'driver' => 'session',
'provider' => 'users',
//'provider' => 'ldap',
],
'api' => [
'driver' => 'token',
'provider' => 'users',
'hash' => false,
],
],
'providers' => [
'users' => [
'driver' => 'eloquent',
'model' => App\Models\User::class,
],
'ldap' => [
'driver' => 'ldap',
'model' => LdapRecord\Models\ActiveDirectory\User::class,
'database' => [
'model' => App\Models\User::class,
'sync_passwords' => true,
'sync_attributes' => [
'name' => 'cn',
'email' => 'mail',
],
'sync_existing' => [
'email' => 'mail',
],
],
],
// 'users' => [
// 'driver' => 'database',
// 'table' => 'users',
// ],
],
I do not mentionned I'm using Laravel 8 and jetstream It seems that the package does'nt know the guid column when he query the database ?
Ok, now can you post your App\Models\User.php
file?
Sure, thanks :
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Foundation\Auth\User as Authenticatable;
use Illuminate\Notifications\Notifiable;
use Laravel\Fortify\TwoFactorAuthenticatable;
use Laravel\Jetstream\HasProfilePhoto;
use Laravel\Jetstream\HasTeams;
use Laravel\Sanctum\HasApiTokens;
use LdapRecord\Laravel\Auth\LdapAuthenticatable;
use LdapRecord\Laravel\Auth\AuthenticatesWithLdap;
class User extends Authenticatable implements LdapAuthenticatable
{
use HasApiTokens;
use HasFactory;
use HasProfilePhoto;
use HasTeams;
use Notifiable;
use TwoFactorAuthenticatable;
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',
'two_factor_recovery_codes',
'two_factor_secret',
];
/**
* The attributes that should be cast to native types.
*
* @var array
*/
protected $casts = [
'email_verified_at' => 'datetime',
];
/**
* The accessors to append to the model's array form.
*
* @var array
*/
protected $appends = [
'profile_photo_url',
];
/**
* Get the database column name for the LDAP domain.
*
* @return string
*/
public function getLdapDomainColumn()
{
// TODO: Implement getLdapDomainColumn() method.
}
/**
* Get the models LDAP domain.
*
* @return string
*/
public function getLdapDomain()
{
// TODO: Implement getLdapDomain() method.
}
/**
* Set the models LDAP domain.
*
* @param string $domain
*
* @return void
*/
public function setLdapDomain($domain)
{
// TODO: Implement setLdapDomain() method.
}
/**
* Get the database column name for the LDAP guid.
*
* @return string
*/
public function getLdapGuidColumn()
{
// TODO: Implement getLdapGuidColumn() method.
}
/**
* Get the models LDAP GUID.
*
* @return string
*/
public function getLdapGuid()
{
// TODO: Implement getLdapGuid() method.
}
/**
* Set the models LDAP GUID.
*
* @param string $guid
*
* @return void
*/
public function setLdapGuid($guid)
{
// TODO: Implement setLdapGuid() method.
}
}
Humm ok I must override the getters ?
You've overridden every method supplied by the AuthenticatesWithLdap
trait.
Remove all of the overridden methods and you're all set. 👍
You've overridden every method supplied by the
AuthenticatesWithLdap
trait.Remove all of the overridden methods and you're all set. 👍
Thanks for your help I followed phpstorm too quickly when he said "hey inject stub methods!" 😂
Environment (please complete the following information):
Describe the bug: When I try to import a single user using the command I cannot achieve I have this error :
It's pretty weird. I just want to import accounts manually I followed the documentation, added implements LdapAuthenticatable to the Laravel User model and stub methods so what do I missed ?
Thanks for your help