Compare commits
No commits in common. "87b811f7169282aec0631fec5fe7f84c4f1f3497" and "6af7813e3d1ddbd477ab86716861149f25564769" have entirely different histories.
87b811f716
...
6af7813e3d
@ -1,2 +0,0 @@
|
|||||||
ALTER TABLE `oauth_clients`
|
|
||||||
MODIFY `client_id` varchar(255) CHARACTER SET ascii COLLATE ascii_bin NOT NULL;
|
|
@ -14,13 +14,12 @@ 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 = $input->getArgument('client-id') ? $input->getArgument('client-id') : bin2hex(random_bytes(8));
|
$clientId = bin2hex(random_bytes(8));
|
||||||
$clientSecret = bin2hex(random_bytes(20));
|
$clientSecret = bin2hex(random_bytes(20));
|
||||||
|
|
||||||
$oAuthClient = new OAuthClient();
|
$oAuthClient = new OAuthClient();
|
||||||
@ -28,7 +27,7 @@ class AddOAuthClientCommand extends Command
|
|||||||
$oAuthClient->setClientSecret($clientSecret);
|
$oAuthClient->setClientSecret($clientSecret);
|
||||||
$oAuthClient->setCreatedDate(new DateTime());
|
$oAuthClient->setCreatedDate(new DateTime());
|
||||||
|
|
||||||
if ($input->getArgument('preapproved')) {
|
if ($input->hasArgument('preapproved') && $input->getArgument('preapproved')) {
|
||||||
$oAuthClient->setPreapproved($input->getArgument('preapproved'));
|
$oAuthClient->setPreapproved($input->getArgument('preapproved'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -59,7 +59,6 @@ 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()),
|
||||||
|
Loading…
Reference in New Issue
Block a user