Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix tests #66

Merged
merged 4 commits into from
Feb 18, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
strategy:
fail-fast: false
matrix:
php-version: ['7.2', '7.3', '7.4', '8.0']
php-version: ['7.2', '7.3', '7.4', '8.0', '8.1']
db-type: [sqlite, mysql, pgsql]
prefer-lowest: ['']

Expand Down
2 changes: 1 addition & 1 deletion src/Authentication/AuthenticationService.php
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ protected function getWebauthn2fAuthenticationChecker()
/**
* Get the configured u2f authentication checker
*
* @return \CakeDC\Auth\Authentication\Webauthn2FAuthenticationCheckerInterface
* @return \CakeDC\Auth\Authentication\U2fAuthenticationCheckerInterface
*/
protected function getU2fAuthenticationChecker()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public function isEnabled()
/**
* Check if two factor authentication is required for a user
*
* @param array $user user data
* @param array<mixed>|null $user user data
* @return bool
*/
public function isRequired(?array $user = null)
Expand Down
2 changes: 1 addition & 1 deletion src/Authentication/DefaultU2fAuthenticationChecker.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public function isEnabled()
/**
* Check if two factor authentication is required for a user
*
* @param array $user user data
* @param array<mixed>|null $user user data
* @return bool
*/
public function isRequired(?array $user = null)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public function isEnabled()
/**
* Check if two factor authentication is required for a user
*
* @param array $user user data
* @param array<mixed>|null $user user data
* @return bool
*/
public function isRequired(?array $user = null)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public function isEnabled();
/**
* Check if two factor authentication is required for a user
*
* @param array $user user data
* @param array<mixed>|null $user user data
* @return bool
*/
public function isRequired(?array $user = null);
Expand Down
2 changes: 1 addition & 1 deletion src/Authentication/U2fAuthenticationCheckerInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public function isEnabled();
/**
* Check if two factor authentication is required for a user
*
* @param array $user user data
* @param array<mixed>|null $user user data
* @return bool
*/
public function isRequired(?array $user = null);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public function isEnabled();
/**
* Check if two factor authentication is required for a user
*
* @param array $user user data
* @param array<mixed>|null $user user data
* @return bool
*/
public function isRequired(?array $user = null);
Expand Down
7 changes: 4 additions & 3 deletions src/Rbac/Rbac.php
Original file line number Diff line number Diff line change
Expand Up @@ -226,10 +226,11 @@ protected function _matchPermission(array $permission, $user, $role, ServerReque
protected function _matchOrAsterisk($possibleValues, $value, $allowEmpty = false)
{
$possibleArray = (array)$possibleValues;

return $possibleValues === '*' ||
$value === $possibleValues ||
in_array($value, $possibleArray) ||
in_array(Inflector::camelize((string)$value, '-'), $possibleArray);
$value === $possibleValues ||
in_array($value, $possibleArray) ||
in_array(Inflector::camelize((string)$value, '-'), $possibleArray);
}

/**
Expand Down
2 changes: 2 additions & 0 deletions tests/TestCase/Authenticator/CookieAuthenticatorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
use Authentication\Identifier\IdentifierCollection;
use Cake\Http\Response;
use Cake\TestSuite\TestCase;
use Cake\Utility\Security;
use CakeDC\Auth\Authenticator\CookieAuthenticator;
use Psr\Http\Message\RequestInterface;
use Psr\Http\Message\ResponseInterface;
Expand Down Expand Up @@ -71,6 +72,7 @@ public function testPersistIdentity($setCookie, $field, array $post, array $sess
'username' => 'johndoe',
'password' => '$2a$10$u05j8FjsvLBNdfhBhc21LOuVMpzpabVXQ9OpC2wO3pSO0q6t7HHMO',
]);
Security::setSalt('22f40226f5b51926aeb29995ebf0108eae3435e2');
$result = $authenticator->persistIdentity($request, $response, $identity);
$this->assertIsArray($result);
$this->assertArrayHasKey('request', $result);
Expand Down