Skip to content

Commit 063f482

Browse files
committed
Configure primary key.
1 parent d4ae104 commit 063f482

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

src/Authenticator/PrimaryKeySessionAuthenticator.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ public function __construct(IdentifierInterface $identifier, array $config = [])
2222
{
2323
$config += [
2424
'identifierKey' => 'key',
25+
'idField' => 'id',
2526
];
2627

2728
parent::__construct($identifier, $config);
@@ -63,7 +64,7 @@ public function persistIdentity(ServerRequestInterface $request, ResponseInterfa
6364

6465
if (!$session->check($sessionKey)) {
6566
$session->renew();
66-
$session->write($sessionKey, $identity['id']);
67+
$session->write($sessionKey, $identity[$this->getConfig('idField')]);
6768
}
6869

6970
return [
@@ -97,8 +98,8 @@ public function impersonate(
9798
'Stop the current impersonation before impersonating another user.',
9899
);
99100
}
100-
$session->write($impersonateSessionKey, $impersonator['id']);
101-
$session->write($sessionKey, $impersonated['id']);
101+
$session->write($impersonateSessionKey, $impersonator[$this->getConfig('idField')]);
102+
$session->write($sessionKey, $impersonated[$this->getConfig('idField')]);
102103
$this->setConfig('identify', true);
103104

104105
return [

0 commit comments

Comments
 (0)