fix
This commit is contained in:
parent
667a45aba1
commit
99924ca144
|
@ -19,21 +19,18 @@ $method = $_SERVER['REQUEST_METHOD'];
|
||||||
$basePath = '/api_candidatos';
|
$basePath = '/api_candidatos';
|
||||||
$normalizedPath = str_replace($basePath, '', $path);
|
$normalizedPath = str_replace($basePath, '', $path);
|
||||||
|
|
||||||
// Enrutamiento
|
|
||||||
switch (true) {
|
switch (true) {
|
||||||
case preg_match('#^/oauth/token#', $normalizedPath):
|
case preg_match('#^/oauth/token#', $normalizedPath):
|
||||||
require_once __DIR__ . '/../src/Oauth/Routes/AuthRoutes.php';
|
echo json_encode(["mensaje" => "Entró en oauth/token"]);
|
||||||
// /../src/candidatos/index.php
|
// require_once __DIR__ . '/../src/Oauth/Routes/AuthRoutes.php';
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case preg_match('#^/candidatos#', $normalizedPath):
|
case preg_match('#^/candidatos#', $normalizedPath):
|
||||||
// Verificar token de OAuth 2.0 antes de acceder a rutas protegidas
|
echo json_encode(["mensaje" => "Entró en candidatos"]);
|
||||||
require_once __DIR__ . '/../src/Oauth/Middleware/AuthMiddleware.php';
|
// require_once __DIR__ . '/../src/Oauth/Middleware/AuthMiddleware.php';
|
||||||
|
// if (\OAuth\Middleware\AuthMiddleware::verifyToken()) {
|
||||||
// Solo continuamos si el token es válido
|
// require_once __DIR__ . '/../src/candidatos/index.php';
|
||||||
if (\OAuth\Middleware\AuthMiddleware::verifyToken()) {
|
// }
|
||||||
require_once __DIR__ . '/../src/candidatos/index.php';
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
@ -41,4 +38,5 @@ switch (true) {
|
||||||
echo json_encode(["error" => "Ruta no encontrada"]);
|
echo json_encode(["error" => "Ruta no encontrada"]);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
Loading…
Reference in New Issue