Skip to content

Commit fcfabae

Browse files
committed
removed deprecated IAuthenticator (BC break)
1 parent 4d49229 commit fcfabae

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
@@ -93,7 +93,7 @@ public function loadConfiguration(): void
9393
}
9494

9595
$builder->addDefinition($this->prefix('authenticator'))
96-
->setType(Nette\Security\IAuthenticator::class)
96+
->setType(Nette\Security\Authenticator::class)
9797
->setFactory(Nette\Security\SimpleAuthenticator::class, [$usersList, $usersRoles, $usersData]);
9898

9999
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 string[] $roles
2222
* @property-read ?int $logoutReason
23-
* @property IAuthenticator $authenticator
23+
* @property Authenticator $authenticator
2424
* @property Authorizator $authorizator
2525
*/
2626
class User
@@ -63,7 +63,7 @@ class User
6363

6464
public function __construct(
6565
private UserStorage $storage,
66-
private ?IAuthenticator $authenticator = null,
66+
private ?Authenticator $authenticator = null,
6767
private ?Authorizator $authorizator = null,
6868
) {
6969
}
@@ -94,9 +94,7 @@ public function login(
9494
$this->identity = $username;
9595
} else {
9696
$authenticator = $this->getAuthenticator();
97-
$this->identity = $authenticator instanceof Authenticator
98-
? $authenticator->authenticate(...func_get_args())
99-
: $authenticator->authenticate(func_get_args());
97+
$this->identity = $authenticator->authenticate(...func_get_args());
10098
}
10199

102100
$id = $this->authenticator instanceof IdentityHandler
@@ -190,7 +188,7 @@ final public function refreshStorage(): void
190188
/**
191189
* Sets authentication handler.
192190
*/
193-
public function setAuthenticator(IAuthenticator $handler): static
191+
public function setAuthenticator(Authenticator $handler): static
194192
{
195193
$this->authenticator = $handler;
196194
return $this;
@@ -200,7 +198,7 @@ public function setAuthenticator(IAuthenticator $handler): static
200198
/**
201199
* Returns authentication handler.
202200
*/
203-
final public function getAuthenticator(): IAuthenticator
201+
final public function getAuthenticator(): Authenticator
204202
{
205203
if (!$this->authenticator) {
206204
throw new Nette\InvalidStateException('Authenticator has not been set.');
@@ -213,7 +211,7 @@ final public function getAuthenticator(): IAuthenticator
213211
/**
214212
* Returns authentication handler, or null if none is set.
215213
*/
216-
final public function getAuthenticatorIfExists(): ?IAuthenticator
214+
final public function getAuthenticatorIfExists(): ?Authenticator
217215
{
218216
return $this->authenticator;
219217
}

0 commit comments

Comments
 (0)