From d2022668a3ca303570486dc805c17aff4291332d Mon Sep 17 00:00:00 2001 From: Tim van Dijen <tvdijen@gmail.com> Date: Sun, 3 Feb 2019 17:46:51 +0100 Subject: [PATCH] Fixes for modules/authYubiKey --- .../authYubiKey/lib/Auth/Process/OTP2YubiPrefix.php | 1 + modules/authYubiKey/lib/Auth/Source/YubiKey.php | 10 ++++++++++ modules/authYubiKey/libextinc/Yubico.php | 4 +++- 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/modules/authYubiKey/lib/Auth/Process/OTP2YubiPrefix.php b/modules/authYubiKey/lib/Auth/Process/OTP2YubiPrefix.php index 42ef300f3..b6e789671 100644 --- a/modules/authYubiKey/lib/Auth/Process/OTP2YubiPrefix.php +++ b/modules/authYubiKey/lib/Auth/Process/OTP2YubiPrefix.php @@ -52,6 +52,7 @@ class OTP2YubiPrefix extends \SimpleSAML\Auth\ProcessingFilter * a 'yubiPrefix' attribute that leaves out the dynamic part. * * @param array &$state The state we should update. + * @return void */ public function process(&$state) { diff --git a/modules/authYubiKey/lib/Auth/Source/YubiKey.php b/modules/authYubiKey/lib/Auth/Source/YubiKey.php index 65ddf8490..864f595cb 100644 --- a/modules/authYubiKey/lib/Auth/Source/YubiKey.php +++ b/modules/authYubiKey/lib/Auth/Source/YubiKey.php @@ -62,10 +62,14 @@ class YubiKey extends \SimpleSAML\Auth\Source /** * The client id/key for use with the Auth_Yubico PHP module. + * @var string */ private $yubi_id; + + /** @var string */ private $yubi_key; + /** * Constructor for this authentication source. * @@ -97,6 +101,7 @@ class YubiKey extends \SimpleSAML\Auth\Source * login page. * * @param array &$state Information about the current authentication. + * @return void */ public function authenticate(&$state) { @@ -162,8 +167,12 @@ class YubiKey extends \SimpleSAML\Auth\Source return null; } + /** * Return the user id part of a one time passord + * + * @param string $otp + * @return string */ public static function getYubiKeyPrefix($otp) { @@ -171,6 +180,7 @@ class YubiKey extends \SimpleSAML\Auth\Source return $uid; } + /** * Attempt to log in using the given username and password. * diff --git a/modules/authYubiKey/libextinc/Yubico.php b/modules/authYubiKey/libextinc/Yubico.php index d6f4c709a..d222f6b67 100644 --- a/modules/authYubiKey/libextinc/Yubico.php +++ b/modules/authYubiKey/libextinc/Yubico.php @@ -125,9 +125,11 @@ class Auth_Yubico // Support https $url = "https://api.yubico.com/wsapi/verify?".$parameters; + /** @var string $responseMsg */ $responseMsg = \SimpleSAML\Utils\HTTP::fetch($url); - if (!preg_match("/status=([a-zA-Z0-9_]+)/", $responseMsg, $out)) { + $out = []; + if (preg_match("/status=([a-zA-Z0-9_]+)/", $responseMsg, $out) !== 1) { throw new Exception('Could not parse response'); } -- GitLab