Skip to content

Commit

Permalink
authentication and behavior tests
Browse files Browse the repository at this point in the history
  • Loading branch information
skie committed Mar 11, 2024
1 parent 83636f6 commit e93a09e
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
1 change: 0 additions & 1 deletion tests/TestCase/Model/Behavior/RegisterBehaviorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ public function setUp(): void
{
parent::setUp();
$table = TableRegistry::getTableLocator()->get('CakeDC/Users.Users');
$table->addBehavior('CakeDC/Users/Register.Register');
$this->Table = $table;
$this->Behavior = $table->behaviors()->Register;
TransportFactory::setConfig('test', ['className' => 'Debug']);
Expand Down
13 changes: 13 additions & 0 deletions tests/TestCase/Provider/AuthenticationServiceProviderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -98,22 +98,26 @@ public function testGetAuthenticationService()
'identityAttribute' => 'identity',
'skipTwoFactorVerify' => true,
'impersonateSessionKey' => 'AuthImpersonate',
'className' => 'Authentication.Session',
],
FormAuthenticator::class => [
'loginUrl' => '/login',
'keyCheckEnabledRecaptcha' => 'Users.reCaptcha.login',
'fields' => ['username' => 'email', 'password' => 'alt_password'],
'className' => 'CakeDC/Auth.Form',
],
TokenAuthenticator::class => [
'header' => null,
'queryParam' => 'api_key',
'tokenPrefix' => null,
'skipTwoFactorVerify' => true,
'className' => 'Authentication.Token',
],
TwoFactorAuthenticator::class => [
'loginUrl' => null,
'urlChecker' => 'Authentication.Default',
'skipTwoFactorVerify' => true,
'className' => 'CakeDC/Auth.TwoFactor',
],
];
$actual = [];
Expand All @@ -135,17 +139,20 @@ public function testGetAuthenticationService()
],
'resolver' => 'Authentication.Orm',
'passwordHasher' => null,
'className' => 'Authentication.Password',
],
TokenIdentifier::class => [
'tokenField' => 'api_token',
'dataField' => 'token',
'resolver' => 'Authentication.Orm',
'hashAlgorithm' => null,
'className' => 'Authentication.Token',
],
JwtSubjectIdentifier::class => [
'tokenField' => 'id',
'dataField' => 'sub',
'resolver' => 'Authentication.Orm',
'className' => 'Authentication.JwtSubject',
],
];
$actual = [];
Expand Down Expand Up @@ -196,18 +203,21 @@ public function testGetAuthenticationServiceWithoutOneTimePasswordAuthenticator(
'fields' => ['username' => 'email'],
'identify' => true,
'impersonateSessionKey' => 'AuthImpersonate',
'className' => 'Authentication.Session',
],
'Form' => [
'className' => 'CakeDC/Auth.Form',
'loginUrl' => '/login',
'fields' => ['username' => 'email', 'password' => 'alt_password'],
'className' => 'CakeDC/Auth.Form',
],
'Token' => [
'className' => 'Authentication.Token',
'skipTwoFactorVerify' => true,
'header' => null,
'queryParam' => 'api_key',
'tokenPrefix' => null,
'className' => 'Authentication.Token',
],
]);
Configure::write('Auth.Identifiers', [
Expand Down Expand Up @@ -237,17 +247,20 @@ public function testGetAuthenticationServiceWithoutOneTimePasswordAuthenticator(
'identityAttribute' => 'identity',
'skipTwoFactorVerify' => true,
'impersonateSessionKey' => 'AuthImpersonate',
'className' => 'Authentication.Session'
],
FormAuthenticator::class => [
'loginUrl' => '/login',
'fields' => ['username' => 'email', 'password' => 'alt_password'],
'keyCheckEnabledRecaptcha' => 'Users.reCaptcha.login',
'className' => 'CakeDC/Auth.Form',
],
TokenAuthenticator::class => [
'header' => null,
'queryParam' => 'api_key',
'tokenPrefix' => null,
'skipTwoFactorVerify' => true,
'className' => 'Authentication.Token',
],
];
$actual = [];
Expand Down

0 comments on commit e93a09e

Please sign in to comment.