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
@@ -55,7 +55,7 @@ class User
5555
5656 /** Session storage for current user */
5757 private UserStorage $ storage ;
58- private ?IAuthenticator $ authenticator ;
58+ private ?Authenticator $ authenticator ;
5959 private ?Authorizator $ authorizator ;
6060 private ?IIdentity $ identity = null ;
6161 private ?bool $ authenticated = null ;
@@ -64,7 +64,7 @@ class User
6464
6565 public function __construct (
6666 UserStorage $ storage ,
67- ?IAuthenticator $ authenticator = null ,
67+ ?Authenticator $ authenticator = null ,
6868 ?Authorizator $ authorizator = null ,
6969 ) {
7070 $ this ->storage = $ storage ;
@@ -98,9 +98,7 @@ public function login(
9898 $ this ->identity = $ user ;
9999 } else {
100100 $ authenticator = $ this ->getAuthenticator ();
101- $ this ->identity = $ authenticator instanceof Authenticator
102- ? $ authenticator ->authenticate (...func_get_args ())
103- : $ authenticator ->authenticate (func_get_args ());
101+ $ this ->identity = $ authenticator ->authenticate (...func_get_args ());
104102 }
105103
106104 $ id = $ this ->authenticator instanceof IdentityHandler
@@ -191,7 +189,7 @@ final public function refreshStorage(): void
191189 /**
192190 * Sets authentication handler.
193191 */
194- public function setAuthenticator (IAuthenticator $ handler ): static
192+ public function setAuthenticator (Authenticator $ handler ): static
195193 {
196194 $ this ->authenticator = $ handler ;
197195 return $ this ;
@@ -201,7 +199,7 @@ public function setAuthenticator(IAuthenticator $handler): static
201199 /**
202200 * Returns authentication handler.
203201 */
204- final public function getAuthenticator (): IAuthenticator
202+ final public function getAuthenticator (): Authenticator
205203 {
206204 if (!$ this ->authenticator ) {
207205 throw new Nette \InvalidStateException ('Authenticator has not been set. ' );
@@ -214,7 +212,7 @@ final public function getAuthenticator(): IAuthenticator
214212 /**
215213 * Returns authentication handler.
216214 */
217- final public function getAuthenticatorIfExists (): ?IAuthenticator
215+ final public function getAuthenticatorIfExists (): ?Authenticator
218216 {
219217 return $ this ->authenticator ;
220218 }
0 commit comments