PHP code example of nusait / nu-auth
1. Go to this page and download the library: Download nusait/nu-auth library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
nusait / nu-auth example snippets
[...
'userCreator' => function ($user, $metadata, $ldap) {
// $user is the laravel model.
// $metadata is the raw metadata from ldap.
// $ldap is the \Nusait\NuLdap\Ldap object.
$user->first_name = $metadata['given_name'][0];
$user->last_name = $metadata['sn'][0];
$user->emplid = $metadata['uid'][0];
$user->save();
//remember to return the $user
return $user;
};
]