Compare commits

..

2 Commits

Author SHA1 Message Date
87b811f716
client id can be anything
All checks were successful
rvr-nextgen/pipeline/pr-master This commit looks good
2023-04-12 02:10:33 +02:00
eb4ebb9582
send clientId as aud 2023-04-12 02:05:44 +02:00
3 changed files with 6 additions and 2 deletions

View File

@ -0,0 +1,2 @@
ALTER TABLE `oauth_clients`
MODIFY `client_id` varchar(255) CHARACTER SET ascii COLLATE ascii_bin NOT NULL;

View File

@ -14,12 +14,13 @@ class AddOAuthClientCommand extends Command
{ {
$this->setName('oauth:add-client') $this->setName('oauth:add-client')
->setDescription('Adding of OAuth client.') ->setDescription('Adding of OAuth client.')
->addArgument('client-id', InputArgument::OPTIONAL, 'Client ID')
->addArgument('preapproved', InputArgument::OPTIONAL, 'Preapproved'); ->addArgument('preapproved', InputArgument::OPTIONAL, 'Preapproved');
} }
public function execute(InputInterface $input, OutputInterface $output): int public function execute(InputInterface $input, OutputInterface $output): int
{ {
$clientId = bin2hex(random_bytes(8)); $clientId = $input->getArgument('client-id') ? $input->getArgument('client-id') : bin2hex(random_bytes(8));
$clientSecret = bin2hex(random_bytes(20)); $clientSecret = bin2hex(random_bytes(20));
$oAuthClient = new OAuthClient(); $oAuthClient = new OAuthClient();
@ -27,7 +28,7 @@ class AddOAuthClientCommand extends Command
$oAuthClient->setClientSecret($clientSecret); $oAuthClient->setClientSecret($clientSecret);
$oAuthClient->setCreatedDate(new DateTime()); $oAuthClient->setCreatedDate(new DateTime());
if ($input->hasArgument('preapproved') && $input->getArgument('preapproved')) { if ($input->getArgument('preapproved')) {
$oAuthClient->setPreapproved($input->getArgument('preapproved')); $oAuthClient->setPreapproved($input->getArgument('preapproved'));
} }

View File

@ -59,6 +59,7 @@ class OAuthController
'iat' => (int)$token->getCreatedDate()->getTimestamp(), 'iat' => (int)$token->getCreatedDate()->getTimestamp(),
'nbf' => (int)$token->getCreatedDate()->getTimestamp(), 'nbf' => (int)$token->getCreatedDate()->getTimestamp(),
'exp' => (int)$token->getExpiresDate()->getTimestamp(), 'exp' => (int)$token->getExpiresDate()->getTimestamp(),
'aud' => $clientId,
'nonce' => $token->getNonce() 'nonce' => $token->getNonce()
], $this->getUserInfoInternal( ], $this->getUserInfoInternal(
$this->userRepository->getById($token->getUserId()), $this->userRepository->getById($token->getUserId()),