Skip to content

Commit 21c3eb4

Browse files
committed
removed deprecated IAuthenticator (BC break)
1 parent e52c512 commit 21c3eb4

4 files changed

Lines changed: 8 additions & 45 deletions

File tree

src/Bridges/SecurityDI/SecurityExtension.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ public function loadConfiguration(): void
112112
}
113113

114114
$builder->addDefinition($this->prefix('authenticator'))
115-
->setType(Nette\Security\IAuthenticator::class)
115+
->setType(Nette\Security\Authenticator::class)
116116
->setFactory(Nette\Security\SimpleAuthenticator::class, [$usersList, $usersRoles, $usersData]);
117117

118118
if ($this->name === 'security') {

src/Security/Authenticator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
/**
1212
* Performs authentication.
1313
*/
14-
interface Authenticator extends IAuthenticator
14+
interface Authenticator
1515
{
1616
/** Exception error code */
1717
public const

src/Security/IAuthenticator.php

Lines changed: 0 additions & 35 deletions
This file was deleted.

src/Security/User.php

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
* @property-read string|int|null $id
2121
* @property-read list<string> $roles
2222
* @property-read ?int $logoutReason
23-
* @property IAuthenticator $authenticator
23+
* @property Authenticator $authenticator
2424
* @property Authorizator $authorizator
2525
*/
2626
class User
@@ -68,7 +68,7 @@ class User
6868

6969
public function __construct(
7070
private UserStorage $storage,
71-
private ?IAuthenticator $authenticator = null,
71+
private ?Authenticator $authenticator = null,
7272
private ?Authorizator $authorizator = null,
7373
) {
7474
}
@@ -99,9 +99,7 @@ public function login(
9999
$this->identity = $username;
100100
} else {
101101
$authenticator = $this->getAuthenticator();
102-
$this->identity = $authenticator instanceof Authenticator
103-
? $authenticator->authenticate(...func_get_args())
104-
: $authenticator->authenticate(func_get_args());
102+
$this->identity = $authenticator->authenticate(...func_get_args());
105103
}
106104

107105
$id = $this->authenticator instanceof IdentityHandler
@@ -214,7 +212,7 @@ final public function refreshStorage(): void
214212
/**
215213
* Sets authentication handler.
216214
*/
217-
public function setAuthenticator(IAuthenticator $handler): static
215+
public function setAuthenticator(Authenticator $handler): static
218216
{
219217
$this->authenticator = $handler;
220218
$this->guestIdentityResolved = false;
@@ -225,7 +223,7 @@ public function setAuthenticator(IAuthenticator $handler): static
225223
/**
226224
* Returns authentication handler.
227225
*/
228-
final public function getAuthenticator(): IAuthenticator
226+
final public function getAuthenticator(): Authenticator
229227
{
230228
if (!$this->authenticator) {
231229
throw new Nette\InvalidStateException('Authenticator has not been set.');
@@ -238,7 +236,7 @@ final public function getAuthenticator(): IAuthenticator
238236
/**
239237
* Returns authentication handler, or null if none is set.
240238
*/
241-
final public function getAuthenticatorIfExists(): ?IAuthenticator
239+
final public function getAuthenticatorIfExists(): ?Authenticator
242240
{
243241
return $this->authenticator;
244242
}

0 commit comments

Comments
 (0)