8
8
9
9
class ExternalBaseUserProvider implements UserProvider
10
10
{
11
- /**
12
- * The user model.
13
- *
14
- * @var string
15
- */
16
- protected $ model ;
17
-
18
- /**
19
- * LdapUserProvider constructor.
20
- */
21
- public function __construct (string $ model )
22
- {
23
- $ this ->model = $ model ;
11
+ public function __construct (
12
+ protected string $ model
13
+ ) {
24
14
}
25
15
26
16
/**
27
17
* Create a new instance of the model.
28
- *
29
- * @return Model
30
18
*/
31
- public function createModel ()
19
+ public function createModel (): Model
32
20
{
33
21
$ class = '\\' . ltrim ($ this ->model , '\\' );
34
22
@@ -37,25 +25,18 @@ public function createModel()
37
25
38
26
/**
39
27
* Retrieve a user by their unique identifier.
40
- *
41
- * @param mixed $identifier
42
- *
43
- * @return Authenticatable|null
44
28
*/
45
- public function retrieveById ($ identifier )
29
+ public function retrieveById (mixed $ identifier ): ? Authenticatable
46
30
{
47
31
return $ this ->createModel ()->newQuery ()->find ($ identifier );
48
32
}
49
33
50
34
/**
51
35
* Retrieve a user by their unique identifier and "remember me" token.
52
36
*
53
- * @param mixed $identifier
54
37
* @param string $token
55
- *
56
- * @return Authenticatable|null
57
38
*/
58
- public function retrieveByToken ($ identifier , $ token )
39
+ public function retrieveByToken (mixed $ identifier , $ token ): null
59
40
{
60
41
return null ;
61
42
}
@@ -75,12 +56,8 @@ public function updateRememberToken(Authenticatable $user, $token)
75
56
76
57
/**
77
58
* Retrieve a user by the given credentials.
78
- *
79
- * @param array $credentials
80
- *
81
- * @return Authenticatable|null
82
59
*/
83
- public function retrieveByCredentials (array $ credentials )
60
+ public function retrieveByCredentials (array $ credentials ): ? Authenticatable
84
61
{
85
62
// Search current user base by looking up a uid
86
63
$ model = $ this ->createModel ();
@@ -92,15 +69,15 @@ public function retrieveByCredentials(array $credentials)
92
69
93
70
/**
94
71
* Validate a user against the given credentials.
95
- *
96
- * @param Authenticatable $user
97
- * @param array $credentials
98
- *
99
- * @return bool
100
72
*/
101
- public function validateCredentials (Authenticatable $ user , array $ credentials )
73
+ public function validateCredentials (Authenticatable $ user , array $ credentials ): bool
102
74
{
103
75
// Should be done in the guard.
104
76
return false ;
105
77
}
78
+
79
+ public function rehashPasswordIfRequired (Authenticatable $ user , #[\SensitiveParameter] array $ credentials , bool $ force = false )
80
+ {
81
+ // No action to perform, any passwords are external in the auth system
82
+ }
106
83
}
0 commit comments