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 */
2727class User
@@ -52,7 +52,7 @@ class User
5252
5353 /** Session storage for current user */
5454 private UserStorage $ storage ;
55- private ?IAuthenticator $ authenticator ;
55+ private ?Authenticator $ authenticator ;
5656 private ?Authorizator $ authorizator ;
5757 private ?IIdentity $ identity = null ;
5858 private ?bool $ authenticated = null ;
@@ -61,7 +61,7 @@ class User
6161
6262 public function __construct (
6363 UserStorage $ storage ,
64- ?IAuthenticator $ authenticator = null ,
64+ ?Authenticator $ authenticator = null ,
6565 ?Authorizator $ authorizator = null ,
6666 ) {
6767 $ this ->storage = $ storage ;
@@ -91,9 +91,7 @@ public function login(string|IIdentity $user, ?string $password = null): void
9191 $ this ->identity = $ user ;
9292 } else {
9393 $ authenticator = $ this ->getAuthenticator ();
94- $ this ->identity = $ authenticator instanceof Authenticator
95- ? $ authenticator ->authenticate (...func_get_args ())
96- : $ authenticator ->authenticate (func_get_args ());
94+ $ this ->identity = $ authenticator ->authenticate (...func_get_args ());
9795 }
9896
9997 $ id = $ this ->authenticator instanceof IdentityHandler
@@ -184,7 +182,7 @@ final public function refreshStorage(): void
184182 /**
185183 * Sets authentication handler.
186184 */
187- public function setAuthenticator (IAuthenticator $ handler ): static
185+ public function setAuthenticator (Authenticator $ handler ): static
188186 {
189187 $ this ->authenticator = $ handler ;
190188 return $ this ;
@@ -194,7 +192,7 @@ public function setAuthenticator(IAuthenticator $handler): static
194192 /**
195193 * Returns authentication handler.
196194 */
197- final public function getAuthenticator (): IAuthenticator
195+ final public function getAuthenticator (): Authenticator
198196 {
199197 if (!$ this ->authenticator ) {
200198 throw new Nette \InvalidStateException ('Authenticator has not been set. ' );
@@ -207,7 +205,7 @@ final public function getAuthenticator(): IAuthenticator
207205 /**
208206 * Returns authentication handler.
209207 */
210- final public function getAuthenticatorIfExists (): ?IAuthenticator
208+ final public function getAuthenticatorIfExists (): ?Authenticator
211209 {
212210 return $ this ->authenticator ;
213211 }
0 commit comments