@@ -39,18 +39,19 @@ class YubiKey extends Auth\Source
3939 /**
4040 * The string used to identify our states.
4141 */
42- public const STAGEID = '\SimpleSAML\Module\authYubiKey\Auth\Source\YubiKey.state ' ;
42+ public const string STAGEID = '\SimpleSAML\Module\authYubiKey\Auth\Source\YubiKey.state ' ;
4343
4444 /**
4545 * The number of characters of the OTP that is the secure token.
4646 * The rest is the user id.
4747 */
48- public const TOKENSIZE = 32 ;
48+ public const int TOKENSIZE = 32 ;
4949
5050 /**
5151 * The key of the AuthId field in the state.
5252 */
53- public const AUTHID = '\SimpleSAML\Module\authYubiKey\Auth\Source\YubiKey.AuthId ' ;
53+ public const string AUTHID = '\SimpleSAML\Module\authYubiKey\Auth\Source\YubiKey.AuthId ' ;
54+
5455
5556 /**
5657 * The client id/key for use with the Auth_Yubico PHP module.
@@ -65,8 +66,8 @@ class YubiKey extends Auth\Source
6566 /**
6667 * Constructor for this authentication source.
6768 *
68- * @param array $info Information about this authentication source.
69- * @param array $config Configuration.
69+ * @param array<mixed> $info Information about this authentication source.
70+ * @param array<mixed> $config Configuration.
7071 */
7172 public function __construct (array $ info , array $ config )
7273 {
@@ -87,7 +88,7 @@ public function __construct(array $info, array $config)
8788 * This function saves the information about the login, and redirects to a
8889 * login page.
8990 *
90- * @param array &$state Information about the current authentication.
91+ * @param array<mixed> &$state Information about the current authentication.
9192 */
9293 public function authenticate (array &$ state ): void
9394 {
@@ -120,9 +121,6 @@ public static function handleLogin(
120121 ) {
121122 /* Retrieve the authentication state. */
122123 $ state = Auth \State::loadState ($ authStateId , self ::STAGEID );
123- if (is_null ($ state )) {
124- throw new Error \NoState ();
125- }
126124
127125 /* Find authentication source. */
128126 Assert::keyExists ($ state , self ::AUTHID );
@@ -158,8 +156,6 @@ public static function handleLogin(
158156
159157 $ state ['Attributes ' ] = $ attributes ;
160158 Auth \Source::completeAuth ($ state );
161-
162- assert (false );
163159 }
164160
165161
@@ -185,8 +181,7 @@ public static function getYubiKeyPrefix(#[\SensitiveParameter] string $otp): str
185181 *
186182 * Note that both the username and the password are UTF-8 encoded.
187183 *
188- * @param string $otp
189- * @return array Associative array with the users attributes.
184+ * @return array<mixed> Associative array with the users attributes.
190185 */
191186 protected function login (#[\SensitiveParameter] string $ userInputOtp ): array
192187 {
0 commit comments