Skip to content

Commit 465d6ab

Browse files
committed
removed deprecated IAuthenticator (BC break)
1 parent 415e032 commit 465d6ab

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
@@ -98,7 +98,7 @@ public function loadConfiguration(): void
9898
}
9999

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

104104
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
@@ -22,7 +22,7 @@
2222
* @property-read string|int $id
2323
* @property-read array $roles
2424
* @property-read int $logoutReason
25-
* @property IAuthenticator $authenticator
25+
* @property Authenticator $authenticator
2626
* @property Authorizator $authorizator
2727
*/
2828
class User
@@ -65,7 +65,7 @@ class User
6565

6666
public function __construct(
6767
private UserStorage $storage,
68-
private ?IAuthenticator $authenticator = null,
68+
private ?Authenticator $authenticator = null,
6969
private ?Authorizator $authorizator = null,
7070
) {
7171
}
@@ -96,9 +96,7 @@ public function login(
9696
$this->identity = $username;
9797
} else {
9898
$authenticator = $this->getAuthenticator();
99-
$this->identity = $authenticator instanceof Authenticator
100-
? $authenticator->authenticate(...func_get_args())
101-
: $authenticator->authenticate(func_get_args());
99+
$this->identity = $authenticator->authenticate(...func_get_args());
102100
}
103101

104102
$id = $this->authenticator instanceof IdentityHandler
@@ -189,7 +187,7 @@ final public function refreshStorage(): void
189187
/**
190188
* Sets authentication handler.
191189
*/
192-
public function setAuthenticator(IAuthenticator $handler): static
190+
public function setAuthenticator(Authenticator $handler): static
193191
{
194192
$this->authenticator = $handler;
195193
return $this;
@@ -199,7 +197,7 @@ public function setAuthenticator(IAuthenticator $handler): static
199197
/**
200198
* Returns authentication handler.
201199
*/
202-
final public function getAuthenticator(): IAuthenticator
200+
final public function getAuthenticator(): Authenticator
203201
{
204202
if (!$this->authenticator) {
205203
throw new Nette\InvalidStateException('Authenticator has not been set.');
@@ -212,7 +210,7 @@ final public function getAuthenticator(): IAuthenticator
212210
/**
213211
* Returns authentication handler.
214212
*/
215-
final public function getAuthenticatorIfExists(): ?IAuthenticator
213+
final public function getAuthenticatorIfExists(): ?Authenticator
216214
{
217215
return $this->authenticator;
218216
}

0 commit comments

Comments
 (0)