more updates
Some checks failed
🧪✨ Tests Workflow / 📝 ✨ Code Lint (push) Successful in 2m25s
🧪✨ Tests Workflow / 🛡️ 🔒 Library Audit (push) Successful in 2m35s
🧪✨ Tests Workflow / 🧪 ✨ Database Migrations (push) Failing after 2m45s
🧪✨ Tests Workflow / 🛡️ 🔒 License Check (push) Successful in 2m36s
🧪✨ Tests Workflow / 🐙 🔍 Code Sniffer (push) Failing after 2m25s
🧪✨ Tests Workflow / 🧪 ✅ Unit Tests (push) Failing after 1m10s

This commit is contained in:
2026-01-02 13:57:41 -05:00
parent d0cee7b48f
commit b5b6caa400
20 changed files with 1251 additions and 872 deletions

View File

@@ -0,0 +1,75 @@
<?php
declare(strict_types=1);
namespace Siteworxpro\App\Cli\Commands\OAuth;
use Siteworxpro\App\Cli\ClimateOutput;
use Siteworxpro\App\Cli\Commands\Command;
use Siteworxpro\App\OAuth\Entities\Client;
use Siteworxpro\App\Services\Facades\Config;
use Symfony\Component\Console\Attribute\AsCommand;
use Symfony\Component\Console\Input\ArgvInput;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
#[AsCommand('oauth:client:list', 'List all OAuth clients')]
class ListClients extends Command
{
protected function configure(): void
{
$this->addArgument('client-id', null, 'Filter by client ID');
}
public function __invoke(ArgvInput|InputInterface $input, ClimateOutput|OutputInterface $output): int
{
if ($input->getArgument('client-id')) {
$client = Client::find($input->getArgument('client-id'));
if (!$client) {
$output->red('No OAuth client found with the specified client ID.');
return self::SUCCESS;
}
$output->json([
'ID' => $client->id,
'Name' => $client->name,
'Client ID' => $client->client_id,
'Client Secret' => $client->client_secret,
'Grant Types' => implode(', ', $client->grant_types->toArray()),
'Access Token Url' => Config::get('app.url') . '/client/access_token',
'OAuth Config Url' => Config::get('app.url') .
'/client/' . $client->id . '/.well-known/openid-configuration',
'Scopes' => $client->scopes->toArray()
]);
return self::SUCCESS;
}
$clients = Client::all('id', 'name', 'client_id', 'client_secret', 'grant_types');
if ($clients->isEmpty()) {
$output->yellow('No OAuth clients found.');
return self::SUCCESS;
}
$outputArray = [];
$clients->map(function (Client $client) use (&$outputArray, $input) {
$outputValues = [
'ID' => $client->id,
'Name' => $client->name,
'Client ID' => $client->client_id,
'Grant Types' => implode(', ', $client->grant_types->toArray()),
];
$outputArray[] = $outputValues;
});
$output->table($outputArray);
return self::SUCCESS;
}
}