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 */
2626class 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