Skip to content

Commit 738cb3a

Browse files
committed
Update UserRepository to check/use 'findAndValidateForPassport' method on user model
1 parent 048c757 commit 738cb3a

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

src/Bridge/UserRepository.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,16 @@ public function getUserEntityByUserCredentials($username, $password, $grantType,
3838
throw new RuntimeException('Unable to determine authentication model from configuration.');
3939
}
4040

41+
if (method_exists($model, 'findAndValidateForPassport')) {
42+
$user = (new $model)->findAndValidateForPassport($username, $password);
43+
44+
if (! $user) {
45+
return;
46+
}
47+
48+
return new User($user->getAuthIdentifier());
49+
}
50+
4151
if (method_exists($model, 'findForPassport')) {
4252
$user = (new $model)->findForPassport($username);
4353
} else {

0 commit comments

Comments
 (0)