Skip to content
Snippets Groups Projects
Commit d2022668 authored by Tim van Dijen's avatar Tim van Dijen
Browse files

Fixes for modules/authYubiKey

parent 57740964
No related branches found
No related tags found
No related merge requests found
...@@ -52,6 +52,7 @@ class OTP2YubiPrefix extends \SimpleSAML\Auth\ProcessingFilter ...@@ -52,6 +52,7 @@ class OTP2YubiPrefix extends \SimpleSAML\Auth\ProcessingFilter
* a 'yubiPrefix' attribute that leaves out the dynamic part. * a 'yubiPrefix' attribute that leaves out the dynamic part.
* *
* @param array &$state The state we should update. * @param array &$state The state we should update.
* @return void
*/ */
public function process(&$state) public function process(&$state)
{ {
......
...@@ -62,10 +62,14 @@ class YubiKey extends \SimpleSAML\Auth\Source ...@@ -62,10 +62,14 @@ class YubiKey extends \SimpleSAML\Auth\Source
/** /**
* The client id/key for use with the Auth_Yubico PHP module. * The client id/key for use with the Auth_Yubico PHP module.
* @var string
*/ */
private $yubi_id; private $yubi_id;
/** @var string */
private $yubi_key; private $yubi_key;
/** /**
* Constructor for this authentication source. * Constructor for this authentication source.
* *
...@@ -97,6 +101,7 @@ class YubiKey extends \SimpleSAML\Auth\Source ...@@ -97,6 +101,7 @@ class YubiKey extends \SimpleSAML\Auth\Source
* login page. * login page.
* *
* @param array &$state Information about the current authentication. * @param array &$state Information about the current authentication.
* @return void
*/ */
public function authenticate(&$state) public function authenticate(&$state)
{ {
...@@ -162,8 +167,12 @@ class YubiKey extends \SimpleSAML\Auth\Source ...@@ -162,8 +167,12 @@ class YubiKey extends \SimpleSAML\Auth\Source
return null; return null;
} }
/** /**
* Return the user id part of a one time passord * Return the user id part of a one time passord
*
* @param string $otp
* @return string
*/ */
public static function getYubiKeyPrefix($otp) public static function getYubiKeyPrefix($otp)
{ {
...@@ -171,6 +180,7 @@ class YubiKey extends \SimpleSAML\Auth\Source ...@@ -171,6 +180,7 @@ class YubiKey extends \SimpleSAML\Auth\Source
return $uid; return $uid;
} }
/** /**
* Attempt to log in using the given username and password. * Attempt to log in using the given username and password.
* *
......
...@@ -125,9 +125,11 @@ class Auth_Yubico ...@@ -125,9 +125,11 @@ class Auth_Yubico
// Support https // Support https
$url = "https://api.yubico.com/wsapi/verify?".$parameters; $url = "https://api.yubico.com/wsapi/verify?".$parameters;
/** @var string $responseMsg */
$responseMsg = \SimpleSAML\Utils\HTTP::fetch($url); $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'); throw new Exception('Could not parse response');
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment