2020 * @property-read string|int|null $id
2121 * @property-read list<string> $roles
2222 * @property-read ?int $logoutReason
23- * @property IAuthenticator $authenticator
23+ * @property Authenticator $authenticator
2424 * @property Authorizator $authorizator
2525 */
2626class User
@@ -68,7 +68,7 @@ class User
6868
6969 public function __construct (
7070 private UserStorage $ storage ,
71- private ?IAuthenticator $ authenticator = null ,
71+ private ?Authenticator $ authenticator = null ,
7272 private ?Authorizator $ authorizator = null ,
7373 ) {
7474 }
@@ -99,9 +99,7 @@ public function login(
9999 $ this ->identity = $ username ;
100100 } else {
101101 $ authenticator = $ this ->getAuthenticator ();
102- $ this ->identity = $ authenticator instanceof Authenticator
103- ? $ authenticator ->authenticate (...func_get_args ())
104- : $ authenticator ->authenticate (func_get_args ());
102+ $ this ->identity = $ authenticator ->authenticate (...func_get_args ());
105103 }
106104
107105 $ id = $ this ->authenticator instanceof IdentityHandler
@@ -214,7 +212,7 @@ final public function refreshStorage(): void
214212 /**
215213 * Sets authentication handler.
216214 */
217- public function setAuthenticator (IAuthenticator $ handler ): static
215+ public function setAuthenticator (Authenticator $ handler ): static
218216 {
219217 $ this ->authenticator = $ handler ;
220218 $ this ->guestIdentityResolved = false ;
@@ -225,7 +223,7 @@ public function setAuthenticator(IAuthenticator $handler): static
225223 /**
226224 * Returns authentication handler.
227225 */
228- final public function getAuthenticator (): IAuthenticator
226+ final public function getAuthenticator (): Authenticator
229227 {
230228 if (!$ this ->authenticator ) {
231229 throw new Nette \InvalidStateException ('Authenticator has not been set. ' );
@@ -238,7 +236,7 @@ final public function getAuthenticator(): IAuthenticator
238236 /**
239237 * Returns authentication handler, or null if none is set.
240238 */
241- final public function getAuthenticatorIfExists (): ?IAuthenticator
239+ final public function getAuthenticatorIfExists (): ?Authenticator
242240 {
243241 return $ this ->authenticator ;
244242 }
0 commit comments