This commit is contained in:
2021-12-25 23:17:15 -03:00
parent bbee033a8a
commit 3580738273
23 changed files with 755 additions and 81 deletions

View File

@ -1,12 +1,8 @@
<?php
use Psr\Http\Message\ServerRequestInterface as Request;
use Psr\Http\Message\ResponseInterface as Response;
use Incoviba\API\Common\Service\Auth as Service;
use Incoviba\API\Common\Controller\Auth;
$app->get('/auth/generate', function(Request $request, Response $response, Service $service): Response {
$key = $service->generate();
$response->getBody()->write(json_encode(['key' => $key]));
return $response
->withStatus(200)
->withHeader('content-type', 'application/json');
});
$app->post('/auth/login[/]', [Auth::class, 'login']);
$app->get('/auth/generate[/]', [Auth::class, 'generate']);
$app->post('/auth/validate[/]', [Auth::class, 'validate']);
$app->post('/auth/user[/]', [Auth::class, 'user']);
$app->post('/auth/logout[/]', [Auth::class, 'logout']);