Basics of auth
Some checks failed
🧪✨ Tests Workflow / 🛡️ 🔒 License Check (push) Successful in 54s
🧪✨ Tests Workflow / 🧪 ✨ Database Migrations (push) Failing after 1m4s
🧪✨ Tests Workflow / 🛡️ 🔒 Library Audit (push) Successful in 1m14s
🧪✨ Tests Workflow / 📝 ✨ Code Lint (push) Successful in 1m10s
🧪✨ Tests Workflow / 🐙 🔍 Code Sniffer (push) Successful in 1m19s
🧪✨ Tests Workflow / 🧪 ✅ Unit Tests (push) Failing after 1m12s

This commit is contained in:
2026-01-02 15:01:26 -05:00
parent b5b6caa400
commit fc6e493355
21 changed files with 51 additions and 189 deletions

View File

@@ -103,7 +103,7 @@ final class AuthorizeController extends Controller
if (
isset($request->getCookieParams()['s']) &&
Redis::exists('session:' . $request->getCookieParams()['s'] ?? '')
Redis::exists('session:' . $request->getCookieParams()['s'])
) {
$s = $request->getCookieParams()['s'];
} else {

View File

@@ -1,66 +0,0 @@
<?php
declare(strict_types=1);
namespace Siteworxpro\App\Controllers;
use Nyholm\Psr7\ServerRequest;
use Psr\Http\Message\ResponseInterface;
use Siteworxpro\App\Attributes\Guards;
use Siteworxpro\App\CommandBus\Commands\ExampleCommand;
use Siteworxpro\App\Docs\TokenSecurity;
use Siteworxpro\App\Docs\UnauthorizedResponse;
use Siteworxpro\App\Http\JsonResponseFactory;
use OpenApi\Attributes as OA;
use Siteworxpro\App\Http\Responses\GenericResponse;
use Siteworxpro\App\Services\Facades\CommandBus;
/**
* Class IndexController
*
* This class handles the index route of the application.
*/
final class IndexController extends Controller
{
/**
* Handles the GET request for the index route.
*
* @throws \JsonException
*/
#[Guards\Jwt]
#[Guards\Scope(['get.index', 'status.check'])]
#[Guards\RequireAllScopes]
#[OA\Get(path: '/', security: [new TokenSecurity()], tags: ['Examples'])]
#[OA\Response(
response: '200',
description: 'An Example Response',
content: new OA\JsonContent(ref: '#/components/schemas/GenericResponse')
)]
#[UnauthorizedResponse]
public function get(ServerRequest $request): ResponseInterface
{
$command = new ExampleCommand($request->getQueryParams()['name'] ?? 'Guest');
$greeting = CommandBus::handle($command);
return JsonResponseFactory::createJsonResponse(new GenericResponse('Server is running. ' . $greeting));
}
/**
* Handles the POST request for the index route.
*
* @throws \JsonException
*/
#[Guards\Jwt]
#[Guards\Scope(['post.index'])]
#[OA\Post(path: '/', security: [new TokenSecurity()], tags: ['Examples'])]
#[OA\Response(
response: '200',
description: 'An Example Response',
content: new OA\JsonContent(ref: '#/components/schemas/GenericResponse')
)]
#[UnauthorizedResponse]
public function post(ServerRequest $request): ResponseInterface
{
return JsonResponseFactory::createJsonResponse(new GenericResponse('POST request received'));
}
}