Replies: 1 comment 3 replies
-
This seems like a fragile hack to me - looking for a better answer... public function findPersonOrFail($username)
{
$users = LdapUser::where('SSO_UID', $username)->get();
$user = null;
switch ($users->count()) {
case 1:
$user = $users->first();
break;
case 0:
abort(403, "There are no users with the SSO ID '{$username}'. If you think this is in error, please contact the helpdesk with your employee number, username and SSO ID.");
break;
default:
abort(403, "There is more than one user with the SSO ID '{$username}'. This is not currently supported.");
break;
}
Auth::getProvider()->setAuthenticatingUser($user);
$eloquentUser = Auth::getProvider()->getLdapUserSynchronizer()->run($user);
$eloquentUser->save();
return $eloquentUser;
} |
Beta Was this translation helpful? Give feedback.
3 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I have a third party authentication provider that some of my users use. I have their outside username stored in my LDAP server. Without a database, I was able to just pass that object to
Auth::login()
and the user would be logged in. Now I am switching to use a backing database and I can't find a way to convert these users.The error message now is
Illuminate\Auth\SessionGuard::login(): Argument #1 ($user) must be of type Illuminate\Contracts\Auth\Authenticatable, LdapRecord\Models\FreeIPA\User given
.I don't see a simple way to convert the
LdapUser
into anEloquentUser
. I thought I could callImport\Synchronizer::createOrFindEloquentModel()
, but it seems like that will require tons of setup since I can't load the existingUserSyncronizer
from the service container (as far as I can tell).Suggestions?
Beta Was this translation helpful? Give feedback.
All reactions