new changes

This commit is contained in:
Niranjan
2026-04-07 20:29:49 +05:30
parent 8fe63c7cf4
commit 31fe556bb0
79 changed files with 2917 additions and 0 deletions

View File

@@ -0,0 +1,29 @@
<?php
namespace App\Modules\PublicApi;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\Request;
use Illuminate\Routing\Controller;
class PublicApiController extends Controller
{
public function __construct(private readonly PublicTokenService $tokens)
{
}
public function issueToken(Request $request): JsonResponse
{
return response()->json([
'data' => $this->tokens->issue($request->all()),
], 201);
}
public function introspect(Request $request): JsonResponse
{
$token = (string) $request->input('token', '');
return response()->json([
'data' => $this->tokens->introspect($token),
]);
}
}

View File

@@ -0,0 +1,23 @@
<?php
namespace App\Modules\PublicApi;
class PublicTokenService
{
public function issue(array $input): array
{
return [
'token' => 'public-token-placeholder',
'scopes' => $input['scopes'] ?? [],
'expires_in' => 3600,
];
}
public function introspect(string $token): array
{
return [
'active' => $token !== '',
'scopes' => [],
];
}
}