Skip to content

Commit

Permalink
Add trailing comma's
Browse files Browse the repository at this point in the history
  • Loading branch information
tvdijen committed Jun 17, 2024
1 parent c173afc commit 493ab64
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 21 deletions.
8 changes: 4 additions & 4 deletions src/Auth/Process/OTP.php
Original file line number Diff line number Diff line change
Expand Up @@ -197,8 +197,8 @@ public static function authenticate(
): bool {
// validate the state array we're given
if (
!array_key_exists(Auth\State::STAGE, $state) ||
$state[Auth\State::STAGE] !== 'yubikey:otp:init'
!array_key_exists(Auth\State::STAGE, $state)
|| $state[Auth\State::STAGE] !== 'yubikey:otp:init'
) {
throw new InvalidArgumentException("There was an unexpected error while trying to verify your YubiKey.");
}
Expand All @@ -209,7 +209,7 @@ public static function authenticate(
if ($otplen < 32 || $otplen > 48) {
throw new InvalidArgumentException(
"The one time password generated by your YubiKey is not valid. Please make"
. " sure to use your YubiKey. You don't have to type anything manually."
. " sure to use your YubiKey. You don't have to type anything manually.",
);
}
$otp = strtolower($otp);
Expand Down Expand Up @@ -241,7 +241,7 @@ public static function authenticate(
$session->registerLogoutHandler(
$cfg['authID'],
$cfg['self'],
'logoutHandler'
'logoutHandler',
);
Logger::info('Successful authentication with YubiKey "' . $kid . '".');
return true;
Expand Down
12 changes: 2 additions & 10 deletions src/Controller/Yubikey.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,6 @@
*/
class Yubikey
{
/** @var \SimpleSAML\Configuration */
protected Configuration $config;

/** @var \SimpleSAML\Session */
protected Session $session;

/**
* @var \SimpleSAML\Auth\State|string
* @psalm-var \SimpleSAML\Auth\State|class-string
Expand All @@ -53,11 +47,9 @@ class Yubikey
* @throws \Exception
*/
public function __construct(
Configuration $config,
Session $session
protected Configuration $config,
protected Session $session,
) {
$this->config = $config;
$this->session = $session;
}


Expand Down
14 changes: 7 additions & 7 deletions tests/src/Controller/YubikeyTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ protected function setUp(): void
'module.enable' => ['yubikey' => true],
],
'[ARRAY]',
'simplesaml'
'simplesaml',
);

$this->session = Session::getSessionFromRequest();
Expand All @@ -60,7 +60,7 @@ public function testOtpNoState(): void
{
$request = Request::create(
'/otp',
'GET'
'GET',
);

$c = new Controller\Yubikey($this->config, $this->session);
Expand All @@ -82,7 +82,7 @@ public function testOtpNoOtp(): void
$request = Request::create(
'/otp',
'GET',
['AuthState' => 'abc123']
['AuthState' => 'abc123'],
);

$c = new Controller\Yubikey($this->config, $this->session);
Expand All @@ -109,7 +109,7 @@ public function testOtpFailed(): void
$request = Request::create(
'/otp?AuthState=someState',
'POST',
['otp' => 'aabbccddeeffgghhiijjkkllmmnnooppqq']
['otp' => 'aabbccddeeffgghhiijjkkllmmnnooppqq'],
);

$c = new Controller\Yubikey($this->config, $this->session);
Expand Down Expand Up @@ -142,7 +142,7 @@ public function testOtpSucceeded(): void
$request = Request::create(
'/otp?AuthState=someState',
'POST',
['otp' => 'aabbccddeeffgghhiijjkkllmmnnooppqq']
['otp' => 'aabbccddeeffgghhiijjkkllmmnnooppqq'],
);

$c = new Controller\Yubikey($this->config, $this->session);
Expand Down Expand Up @@ -175,7 +175,7 @@ public function testOtpUnexpectedException(): void
$request = Request::create(
'/otp?AuthState=someState',
'POST',
['otp' => 'aabbccddeeffgghhiijjkkllmmnnooppqq']
['otp' => 'aabbccddeeffgghhiijjkkllmmnnooppqq'],
);

$c = new Controller\Yubikey($this->config, $this->session);
Expand All @@ -189,7 +189,7 @@ public static function loadState(string $id, string $stage, bool $allowMissing =
public static function authenticate(array &$state, string $otp): bool
{
throw new InvalidArgumentException(
"There was an unexpected error while trying to verify your YubiKey."
"There was an unexpected error while trying to verify your YubiKey.",
);
}
});
Expand Down

0 comments on commit 493ab64

Please sign in to comment.