Skip to content

Commit a6c9ee1

Browse files
committed
removed deprecated IAuthenticator (BC break)
1 parent 3382b09 commit a6c9ee1

File tree

4 files changed

+8
-47
lines changed

4 files changed

+8
-47
lines changed

src/Bridges/SecurityDI/SecurityExtension.php

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

9999
$builder->addDefinition($this->prefix('authenticator'))
100-
->setType(Nette\Security\IAuthenticator::class)
100+
->setType(Nette\Security\Authenticator::class)
101101
->setFactory(Nette\Security\SimpleAuthenticator::class, [$usersList, $usersRoles, $usersData]);
102102

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

src/Security/Authenticator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
/**
1414
* Performs authentication.
1515
*/
16-
interface Authenticator extends IAuthenticator
16+
interface Authenticator
1717
{
1818
/** Exception error code */
1919
public const

src/Security/IAuthenticator.php

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

src/Security/User.php

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
* @property-read string|int $id
2222
* @property-read array $roles
2323
* @property-read int $logoutReason
24-
* @property IAuthenticator $authenticator
24+
* @property Authenticator $authenticator
2525
* @property Authorizator $authorizator
2626
*/
2727
class User
@@ -64,7 +64,7 @@ class User
6464

6565
public function __construct(
6666
private UserStorage $storage,
67-
private ?IAuthenticator $authenticator = null,
67+
private ?Authenticator $authenticator = null,
6868
private ?Authorizator $authorizator = null,
6969
) {
7070
}
@@ -95,9 +95,7 @@ public function login(
9595
$this->identity = $user;
9696
} else {
9797
$authenticator = $this->getAuthenticator();
98-
$this->identity = $authenticator instanceof Authenticator
99-
? $authenticator->authenticate(...func_get_args())
100-
: $authenticator->authenticate(func_get_args());
98+
$this->identity = $authenticator->authenticate(...func_get_args());
10199
}
102100

103101
$id = $this->authenticator instanceof IdentityHandler
@@ -188,7 +186,7 @@ final public function refreshStorage(): void
188186
/**
189187
* Sets authentication handler.
190188
*/
191-
public function setAuthenticator(IAuthenticator $handler): static
189+
public function setAuthenticator(Authenticator $handler): static
192190
{
193191
$this->authenticator = $handler;
194192
return $this;
@@ -198,7 +196,7 @@ public function setAuthenticator(IAuthenticator $handler): static
198196
/**
199197
* Returns authentication handler.
200198
*/
201-
final public function getAuthenticator(): IAuthenticator
199+
final public function getAuthenticator(): Authenticator
202200
{
203201
if (!$this->authenticator) {
204202
throw new Nette\InvalidStateException('Authenticator has not been set.');
@@ -211,7 +209,7 @@ final public function getAuthenticator(): IAuthenticator
211209
/**
212210
* Returns authentication handler.
213211
*/
214-
final public function getAuthenticatorIfExists(): ?IAuthenticator
212+
final public function getAuthenticatorIfExists(): ?Authenticator
215213
{
216214
return $this->authenticator;
217215
}

0 commit comments

Comments
 (0)