Skip to content

Commit 5555ba2

Browse files
authored
Merge pull request #1144 from gdebrauwer/find-and-validate-for-passport-password-grant
[8.x] Modify UserRepository to check for 'findAndValidateForPassport' method
2 parents b5e9198 + 738cb3a commit 5555ba2

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)