Skip to content

Commit

Permalink
improving identity key token authorization
Browse files Browse the repository at this point in the history
  • Loading branch information
jturbide committed Feb 29, 2024
1 parent 5a61042 commit 3a5a77e
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/Identity.php
Original file line number Diff line number Diff line change
Expand Up @@ -829,6 +829,7 @@ public function reset(array $params = null)

/**
* Get key / token fields to use for the session fetch & validation
* @throws ValidatorException
*/
public function getKeyToken(string $jwt = null, string $key = null, string $token = null): array
{
Expand Down Expand Up @@ -859,10 +860,14 @@ public function getKeyToken(string $jwt = null, string $key = null, string $toke
elseif (!empty($authorization)) {
$authorizationType = $authorization[0] ?? 'Bearer';
$authorizationToken = $authorization[1] ?? null;
if (strtolower($authorizationType) === 'bearer') {
if ($authorizationToken && strtolower($authorizationType) === 'bearer') {
$sessionClaim = $this->getClaim($authorizationToken, $this->sessionKey);
$key = $sessionClaim['key'] ?? null;
$token = $sessionClaim['token'] ?? null;
} else {
// missing token or unsupported authorization
$key = null;
$token = null;
}
}
elseif ($this->config->path('identity.sessionFallback', false) &&
Expand Down

0 comments on commit 3a5a77e

Please sign in to comment.