Skip to content

Commit

Permalink
Fix casing
Browse files Browse the repository at this point in the history
  • Loading branch information
tvdijen committed Dec 10, 2021
1 parent 645055c commit d239b4d
Show file tree
Hide file tree
Showing 7 changed files with 24 additions and 25 deletions.
4 changes: 2 additions & 2 deletions composer.json
Expand Up @@ -17,11 +17,11 @@
}
},
"extra": {
"ssp-mixedcase-module-name": "authYubikey"
"ssp-mixedcase-module-name": "authYubiKey"
},
"autoload": {
"psr-4": {
"SimpleSAML\\Module\\authYubikey\\": "lib/"
"SimpleSAML\\Module\\authYubiKey\\": "lib/"
}
},
"autoload-dev": {
Expand Down
2 changes: 1 addition & 1 deletion lib/Auth/Process/OTP2YubiPrefix.php
Expand Up @@ -2,7 +2,7 @@

declare(strict_types=1);

namespace SimpleSAML\Module\authYubikey\Auth\Process;
namespace SimpleSAML\Module\authYubiKey\Auth\Process;

use SimpleSAML\Assert\Assert;
use SimpleSAML\Auth;
Expand Down
10 changes: 5 additions & 5 deletions lib/Auth/Source/YubiKey.php
@@ -1,6 +1,6 @@
<?php

namespace SimpleSAML\Module\authYubikey\Auth\Source;
namespace SimpleSAML\Module\authYubiKey\Auth\Source;

use Exception;
use GuzzleHttp\Client as GuzzleClient;
Expand All @@ -23,15 +23,15 @@
* Configure it by adding an entry to config/authsources.php such as this:
*
* 'yubikey' => [
* 'authYubikey:YubiKey',
* 'authYubiKey:YubiKey',
* 'id' => 997,
* 'key' => 'b64hmackey',
* ],
*
* To generate your own client id/key you will need one YubiKey, and then
* go to http://yubico.com/developers/api/
*
* @package simplesamlphp/simplesamlphp-module-authYubikey
* @package simplesamlphp/simplesamlphp-module-authyubikey
*/

class YubiKey extends Auth\Source
Expand Down Expand Up @@ -97,7 +97,7 @@ public function authenticate(array &$state): void
$state[self::AUTHID] = $this->authId;

$id = Auth\State::saveState($state, self::STAGEID);
$url = Module::getModuleURL('authYubikey/login');
$url = Module::getModuleURL('authYubiKey/login');
$httpUtils = new Utils\HTTP();
$httpUtils->redirectTrustedURL($url, ['AuthState' => $id]);
}
Expand Down Expand Up @@ -137,7 +137,7 @@ public static function handleLogin(string $authStateId, string $otp)
/**
* Attempt to log in.
*
* @var \SimpleSAML\Module\authYubikey\Auth\Source\YubiKey $source
* @var \SimpleSAML\Module\authYubiKey\Auth\Source\YubiKey $source
*/
$attributes = $source->login($otp);
} catch (Error\Error $e) {
Expand Down
14 changes: 7 additions & 7 deletions lib/Controller/Yubikey.php
Expand Up @@ -2,11 +2,11 @@

declare(strict_types=1);

namespace SimpleSAML\Module\authYubikey\Controller;
namespace SimpleSAML\Module\authYubiKey\Controller;

use SimpleSAML\Configuration;
use SimpleSAML\Error;
use SimpleSAML\Module\authYubikey\Auth\Source;
use SimpleSAML\Module\authYubiKey\Auth\Source;
use SimpleSAML\Session;
use SimpleSAML\XHTML\Template;
use Symfony\Component\HttpFoundation\Request;
Expand All @@ -27,8 +27,8 @@ class Yubikey
protected Session $session;

/**
* @var \SimpleSAML\Module\authYubikey\Auth\Source\YubiKey|string
* @psalm-var \SimpleSAML\Module\authYubikey\Auth\Source\YubiKey|class-string
* @var \SimpleSAML\Module\authYubiKey\Auth\Source\YubiKey|string
* @psalm-var \SimpleSAML\Module\authYubiKey\Auth\Source\YubiKey|class-string
*/
protected $yubikey = Source\YubiKey::class;

Expand All @@ -53,9 +53,9 @@ public function __construct(


/**
* Inject the \SimpleSAML\Module\authYubikey\Auth\Source\YubiKey dependency.
* Inject the \SimpleSAML\Module\authYubiKey\Auth\Source\YubiKey dependency.
*
* @param \SimpleSAML\Module\authYubikey\Auth\Source\YubiKey $yubikey
* @param \SimpleSAML\Module\authYubiKey\Auth\Source\YubiKey $yubikey
*/
public function setYubikey(Source\Yubikey $yubikey): void
{
Expand All @@ -74,7 +74,7 @@ public function main(Request $request): Template
throw new Error\BadRequest('Missing AuthState parameter.');
}

$t = new Template($this->config, 'authYubikey:yubikeylogin.twig');
$t = new Template($this->config, 'authYubiKey:yubikeylogin.twig');

$errorCode = null;
$otp = $request->get('otp');
Expand Down
2 changes: 1 addition & 1 deletion routing/routes/routes.yml
@@ -1,3 +1,3 @@
authyubikey-main:
path: /login
defaults: { _controller: 'SimpleSAML\Module\authyubikey\Controller\Yubikey::main' }
defaults: { _controller: 'SimpleSAML\Module\authYubiKey\Controller\Yubikey::main' }
2 changes: 1 addition & 1 deletion tests/bootstrap.php
Expand Up @@ -6,7 +6,7 @@
require_once($projectRoot . '/vendor/autoload.php');

// Symlink module into ssp vendor lib so that templates and urls can resolve correctly
$linkPath = $projectRoot . '/vendor/simplesamlphp/simplesamlphp/modules/authYubikey';
$linkPath = $projectRoot . '/vendor/simplesamlphp/simplesamlphp/modules/authYubiKey';
if (file_exists($linkPath) === false) {
echo "Linking '$linkPath' to '$projectRoot'\n";
symlink($projectRoot, $linkPath);
Expand Down
15 changes: 7 additions & 8 deletions tests/lib/Controller/YubikeyTest.php
Expand Up @@ -2,22 +2,21 @@

declare(strict_types=1);

namespace SimpleSAML\Test\Module\authYubikey\Controller;
namespace SimpleSAML\Test\Module\authYubiKey\Controller;

use PHPUnit\Framework\TestCase;
//use SimpleSAML\Auth\State as AuthState;
use SimpleSAML\Configuration;
use SimpleSAML\Error;
use SimpleSAML\Module\authYubikey\Auth\Source\YubiKey;
use SimpleSAML\Module\authYubikey\Controller;
use SimpleSAML\Module\authYubiKey\Auth\Source\YubiKey;
use SimpleSAML\Module\authYubiKey\Controller;
use SimpleSAML\Session;
use SimpleSAML\XHTML\Template;
use Symfony\Component\HttpFoundation\Request;

/**
* Set of tests for the controllers in the "authyubikey" module.
* Set of tests for the controllers in the "authYubiKey" module.
*
* @covers \SimpleSAML\Module\authYubikey\Controller\Yubikey
* @covers \SimpleSAML\Module\authYubiKey\Controller\Yubikey
*/
class YubikeyTest extends TestCase
{
Expand All @@ -37,7 +36,7 @@ protected function setUp(): void

$this->config = Configuration::loadFromArray(
[
'module.enable' => ['authYubikey' => true],
'module.enable' => ['authYubiKey' => true],
],
'[ARRAY]',
'simplesaml'
Expand Down Expand Up @@ -113,7 +112,7 @@ public function testWrongOtp(): void
);

$c = new Controller\Yubikey($this->config, $this->session);
$c->setYubikey(new class (['AuthId' => 'authYubikey'], []) extends YubiKey {
$c->setYubikey(new class (['AuthId' => 'authYubiKey'], []) extends YubiKey {
public static function handleLogin(string $stateId, string $otp): ?string
{
return 'WRONGUSERPASS';
Expand Down

0 comments on commit d239b4d

Please sign in to comment.