Skip to content

Commit d4ae104

Browse files
committed
Fix CS.
1 parent 641cfee commit d4ae104

3 files changed

Lines changed: 8 additions & 7 deletions

File tree

docs/en/authenticators.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,11 @@ It also helps to avoid session invalidation.
3737
Session itself stores the entity object including nested objects like DateTime or enums.
3838
With only the ID stored, the invalidation due to objects being modified will also dissolve.
3939

40-
Make sure to match this with a Token identifier with ``id`` keys:
40+
Make sure to match this with a Token identifier with ``key``/``id`` keys:
4141

4242
$service->loadIdentifier('Authentication.Token', [
43-
'tokenField' => 'id',
44-
'dataField' => 'id',
43+
'tokenField' => 'id', // lookup for DB table
44+
'dataField' => 'key', // incoming data
4545
'resolver' => 'Authentication.Orm',
4646
]);
4747

src/Authenticator/PrimaryKeySessionAuthenticator.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,10 @@ class PrimaryKeySessionAuthenticator extends SessionAuthenticator
1818
* @param \Authentication\Identifier\IdentifierInterface $identifier
1919
* @param array<string, mixed> $config
2020
*/
21-
public function __construct(IdentifierInterface $identifier, array $config = []) {
21+
public function __construct(IdentifierInterface $identifier, array $config = [])
22+
{
2223
$config += [
23-
'identifierKey' => 'id',
24+
'identifierKey' => 'key',
2425
];
2526

2627
parent::__construct($identifier, $config);

tests/TestCase/Authenticator/PrimaryKeySessionAuthenticatorTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ public function testAuthenticateSuccess()
8484
$this->identifiers = new IdentifierCollection([
8585
'Authentication.Token' => [
8686
'tokenField' => 'id',
87-
'dataField' => 'id',
87+
'dataField' => 'key',
8888
'resolver' => [
8989
'className' => 'Authentication.Orm',
9090
'userModel' => 'AuthUsers',
@@ -121,7 +121,7 @@ public function testAuthenticateSuccessCustomFinder()
121121
$this->identifiers = new IdentifierCollection([
122122
'Authentication.Token' => [
123123
'tokenField' => 'id',
124-
'dataField' => 'id',
124+
'dataField' => 'key',
125125
'resolver' => [
126126
'className' => 'Authentication.Orm',
127127
'userModel' => 'AuthUsers',

0 commit comments

Comments
 (0)