Compare commits

..

No commits in common. "87b811f7169282aec0631fec5fe7f84c4f1f3497" and "6af7813e3d1ddbd477ab86716861149f25564769" have entirely different histories.

3 changed files with 2 additions and 6 deletions

View File

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

View File

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

View File

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