Created
October 24, 2022 13:54
-
-
Save miquelangeld/2df7646c47484e937b95e50b5a6931c8 to your computer and use it in GitHub Desktop.
Backpack with LdapRecord
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//comment the current 'users' node and add this: | |
'users' => [ | |
'driver' => 'ldap', | |
'model' => LdapRecord\Models\ActiveDirectory\User::class, | |
'rules' => [], | |
'database' => [ | |
'model' => App\Models\User::class, | |
'sync_passwords' => false, | |
'sync_attributes' => [ | |
'name' => 'cn', | |
'email' => 'mail', | |
'username' =>'samaccountname' | |
], | |
'sync_existing' => [ | |
'email' => 'mail', | |
], | |
], |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//modify this lines | |
'authentication_column' => 'samaccountname', | |
'authentication_column_name' => 'username', | |
'guard' => null, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
guid, domain, username |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace App\Models; | |
// use Illuminate\Contracts\Auth\MustVerifyEmail; | |
use Illuminate\Database\Eloquent\Factories\HasFactory; | |
use Illuminate\Foundation\Auth\User as Authenticatable; | |
use Illuminate\Notifications\Notifiable; | |
use Laravel\Sanctum\HasApiTokens; | |
use LdapRecord\Laravel\Auth\LdapAuthenticatable; | |
use LdapRecord\Laravel\Auth\AuthenticatesWithLdap; | |
class User extends Authenticatable implements LdapAuthenticatable | |
{ | |
use HasApiTokens, HasFactory, Notifiable; | |
use AuthenticatesWithLdap; | |
/** | |
* The attributes that are mass assignable. | |
* | |
* @var array<int, string> | |
*/ | |
protected $fillable = [ | |
'name', | |
'email', | |
'password', | |
]; | |
/** | |
* The attributes that should be hidden for serialization. | |
* | |
* @var array<int, string> | |
*/ | |
protected $hidden = [ | |
'password', | |
'remember_token', | |
]; | |
/** | |
* The attributes that should be cast. | |
* | |
* @var array<string, string> | |
*/ | |
protected $casts = [ | |
'email_verified_at' => 'datetime', | |
]; | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment