make nonce optional
This commit is contained in:
parent
6e1ee839ba
commit
8cacbfcb62
@ -0,0 +1,2 @@
|
|||||||
|
ALTER TABLE `oauth_sessions`
|
||||||
|
MODIFY `nonce` varchar(255) CHARACTER SET ascii COLLATE ascii_bin DEFAULT NULL;
|
@ -109,8 +109,10 @@ class OAuthController
|
|||||||
'nbf' => $session->getCreatedDate()->getTimestamp(),
|
'nbf' => $session->getCreatedDate()->getTimestamp(),
|
||||||
'exp' => $token->getExpiresDate()->getTimestamp(),
|
'exp' => $token->getExpiresDate()->getTimestamp(),
|
||||||
'aud' => $session->getClientId(),
|
'aud' => $session->getClientId(),
|
||||||
'nonce' => $session->getNonce()
|
|
||||||
];
|
];
|
||||||
|
if ($session->getNonce() !== null) {
|
||||||
|
$commonPayload['none'] = $session->getNonce();
|
||||||
|
}
|
||||||
$idTokenPayload = array_merge($commonPayload, $this->getUserInfoInternal(
|
$idTokenPayload = array_merge($commonPayload, $this->getUserInfoInternal(
|
||||||
$this->userRepository->getById($session->getUserId()),
|
$this->userRepository->getById($session->getUserId()),
|
||||||
$session->getScopeArray())
|
$session->getScopeArray())
|
||||||
|
@ -29,7 +29,7 @@ class OAuthSessionController implements IAuthenticationRequired
|
|||||||
$clientId = \Container::$request->query('client_id');
|
$clientId = \Container::$request->query('client_id');
|
||||||
$scope = \Container::$request->query('scope') ? \Container::$request->query('scope'): '';
|
$scope = \Container::$request->query('scope') ? \Container::$request->query('scope'): '';
|
||||||
$state = \Container::$request->query('state');
|
$state = \Container::$request->query('state');
|
||||||
$nonce = \Container::$request->query('nonce') ? \Container::$request->query('nonce'): '';
|
$nonce = \Container::$request->query('nonce') ? \Container::$request->query('nonce'): null;
|
||||||
$codeChallenge = \Container::$request->query('code_challenge') ?: null;
|
$codeChallenge = \Container::$request->query('code_challenge') ?: null;
|
||||||
$codeChallengeMethod = \Container::$request->query('code_challenge_method') ?: null;
|
$codeChallengeMethod = \Container::$request->query('code_challenge_method') ?: null;
|
||||||
|
|
||||||
|
@ -19,7 +19,7 @@ class OAuthSession extends Model
|
|||||||
|
|
||||||
private array $scope = [];
|
private array $scope = [];
|
||||||
|
|
||||||
private string $nonce = '';
|
private ?string $nonce = '';
|
||||||
|
|
||||||
private ?string $codeChallenge = null;
|
private ?string $codeChallenge = null;
|
||||||
|
|
||||||
@ -52,7 +52,7 @@ class OAuthSession extends Model
|
|||||||
$this->setScopeArray(explode(' ', $scope));
|
$this->setScopeArray(explode(' ', $scope));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function setNonce(string $nonce): void
|
public function setNonce(?string $nonce): void
|
||||||
{
|
{
|
||||||
$this->nonce = $nonce;
|
$this->nonce = $nonce;
|
||||||
}
|
}
|
||||||
@ -125,7 +125,7 @@ class OAuthSession extends Model
|
|||||||
return $this->scope;
|
return $this->scope;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getNonce(): string
|
public function getNonce(): ?string
|
||||||
{
|
{
|
||||||
return $this->nonce;
|
return $this->nonce;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user