From e59b85701ca0714f11ddcc958b325b985423c7b5 Mon Sep 17 00:00:00 2001 From: afornerot Date: Mon, 6 Jul 2020 11:19:44 +0200 Subject: [PATCH] rest api --- .../CoreBundle/Controller/RestController.php | 13 +++++++++++++ .../Cadoles/CoreBundle/Resources/config/routing.yml | 4 ++++ 2 files changed, 17 insertions(+) diff --git a/src/ninegate-1.0/src/Cadoles/CoreBundle/Controller/RestController.php b/src/ninegate-1.0/src/Cadoles/CoreBundle/Controller/RestController.php index fef0e766..d60b7bea 100644 --- a/src/ninegate-1.0/src/Cadoles/CoreBundle/Controller/RestController.php +++ b/src/ninegate-1.0/src/Cadoles/CoreBundle/Controller/RestController.php @@ -29,6 +29,19 @@ use Cadoles\CoreBundle\Form\UserType; class RestController extends Controller { + public function loginAction($key,Request $request) + { + $output=[]; + + // Vérification de la clé + $realkey = $this->getParameter("apikeyninegate"); + if($key!=$realkey) { + $output["error"]="error key"; + return new Response(json_encode($output), 400); + } + + return new Response(json_encode($output), 200); + } public function userAction($key, $login, Request $request) { diff --git a/src/ninegate-1.0/src/Cadoles/CoreBundle/Resources/config/routing.yml b/src/ninegate-1.0/src/Cadoles/CoreBundle/Resources/config/routing.yml index b96d99ba..30b2042c 100644 --- a/src/ninegate-1.0/src/Cadoles/CoreBundle/Resources/config/routing.yml +++ b/src/ninegate-1.0/src/Cadoles/CoreBundle/Resources/config/routing.yml @@ -492,6 +492,10 @@ cadoles_core_config_statistic: defaults: { _controller: CadolesCoreBundle:Statistic:list } #== REST ================================================================================================================== +cadoles_core_rest_login: + path: /rest/login/{key} + defaults: { _controller: CadolesCoreBundle:Rest:login } + cadoles_core_rest_user: path: /rest/user/{key}/{login} defaults: { _controller: CadolesCoreBundle:Rest:user }