File tree Expand file tree Collapse file tree 5 files changed +9
-12
lines changed
Authentication/Authenticators Expand file tree Collapse file tree 5 files changed +9
-12
lines changed Original file line number Diff line number Diff line change @@ -227,7 +227,7 @@ public function getBearerToken(): ?string
227227 */
228228 public function recordActive (): void
229229 {
230- if (! $ this ->user instanceof User ) {
230+ if (! $ this ->user instanceof Authenticatable ) {
231231 throw new InvalidArgumentException (self ::class . '::recordActive() requires logged in user before calling. ' );
232232 }
233233
Original file line number Diff line number Diff line change @@ -172,13 +172,7 @@ public function loggedIn(): bool
172172 */
173173 public function login (Authenticatable $ user ): bool
174174 {
175- /**
176- * @todo Authenticatable should define getEmailIdentity() or this should require User
177- */
178- if (! $ user instanceof User) {
179- throw new InvalidArgumentException (self ::class . '::login() only accepts Shield User ' );
180- }
181-
175+ // @todo Authenticatable should define getEmailIdentity() or this should require User
182176 $ this ->user = $ user ;
183177
184178 // Update the user's last used date on their password identity.
@@ -297,7 +291,7 @@ public function getUser(): ?Authenticatable
297291 */
298292 public function recordActive (): void
299293 {
300- if (! $ this ->user instanceof User ) {
294+ if (! $ this ->user instanceof Authenticatable ) {
301295 throw new InvalidArgumentException (self ::class . '::recordActive() requires logged in user before calling. ' );
302296 }
303297
Original file line number Diff line number Diff line change 66use CodeIgniter \Events \Events ;
77use CodeIgniter \HTTP \RedirectResponse ;
88use CodeIgniter \Shield \Entities \User ;
9+ use CodeIgniter \Shield \Interfaces \Authenticatable ;
910use CodeIgniter \Shield \Interfaces \UserProvider ;
1011use CodeIgniter \Validation \Validation ;
1112
@@ -115,7 +116,7 @@ protected function getUserProvider(): UserProvider
115116 /**
116117 * Returns the Entity class that should be used
117118 */
118- protected function getUserEntity (): User
119+ protected function getUserEntity (): Authenticatable
119120 {
120121 return new User ();
121122 }
Original file line number Diff line number Diff line change 55use CodeIgniter \Model ;
66use CodeIgniter \Shield \Authentication \Traits \UserProvider as UserProviderTrait ;
77use CodeIgniter \Shield \Entities \User ;
8+ use CodeIgniter \Shield \Interfaces \Authenticatable ;
89use CodeIgniter \Shield \Interfaces \UserProvider ;
910use Faker \Generator ;
1011use InvalidArgumentException ;
@@ -101,7 +102,7 @@ protected function fetchIdentities(array $data): array
101102 * Adds a user to the default group.
102103 * Used during registration.
103104 */
104- public function addToDefaultGroup (User $ user ): void
105+ public function addToDefaultGroup (Authenticatable $ user ): void
105106 {
106107 $ defaultGroup = setting ('AuthGroups.defaultGroup ' );
107108 $ allowedGroups = array_keys (setting ('AuthGroups.groups ' ));
Original file line number Diff line number Diff line change 33namespace CodeIgniter \Shield \Test ;
44
55use CodeIgniter \Shield \Entities \User ;
6+ use CodeIgniter \Shield \Interfaces \Authenticatable ;
67
78/**
89 * Trait AuthenticationTesting
@@ -16,7 +17,7 @@ trait AuthenticationTesting
1617 *
1718 * @return $this
1819 */
19- public function actingAs (User $ user )
20+ public function actingAs (Authenticatable $ user )
2021 {
2122 // Ensure the helper is loaded during tests.
2223 helper ('auth ' );
You can’t perform that action at this time.
0 commit comments