From 3d36d8d88e100cbfa519b275dbd62cc3049c0997 Mon Sep 17 00:00:00 2001 From: Gowtham M Date: Tue, 2 Dec 2025 17:16:35 +0530 Subject: [PATCH] App signature added in all rest api --- app/Config/Routes.php | 59 +++++++++++-------- .../RestAuthenticationController.php | 5 +- 2 files changed, 38 insertions(+), 26 deletions(-) diff --git a/app/Config/Routes.php b/app/Config/Routes.php index 7cdb968..d4957b6 100755 --- a/app/Config/Routes.php +++ b/app/Config/Routes.php @@ -439,45 +439,21 @@ $routes->cli('cli/check_bounce_mail_cli', 'MasterController::testCheckBounceMail $routes->cli('cli/app_check_list', 'MasterController::appCheckList'); $routes->cli('cli/new_gdrive_token', 'GoogleDriveController::generateNewGoogleDriveAccessToken'); -//Employee login api's -$routes->post("/employeeRest/verifyEmployeeNumber", "RestAuthenticationController::verifyEmployeeWithMobileNumber"); -$routes->post("/employeeRest/getVerifiedUserData", "RestAuthenticationController::getVerifiedUserData"); -$routes->post("/employeeRest/verifyEmployeeEmailId", "RestAuthenticationController::verifyEmployeeWithEmailId"); -// $routes->post("/employeeRest/saveMpin", "RestAuthenticationController::saveMpin"); -//HR login api's -$routes->post("/employeeRest/verifyHrWithMobileNumber", "RestAuthenticationController::verifyHrWithMobileNumber"); -$routes->post("/employeeRest/verifyHrWithEmail", "RestAuthenticationController::verifyHrWithEmail"); -$routes->post("/employeeRest/getVerifiedHrData", "RestAuthenticationController::getVerifiedHrData"); - $routes->group("/api", ["filter" => "authJWT"], function ($routes) { $routes->post("logined", "RestAuthenticationController::logined"); $routes->post("getId", "RestAuthenticationController::getUserIdFromToken"); }); -// MPIN api's -$routes->post("employeeRest/saveMpin", "RestAuthenticationController::saveMpin"); -$routes->post("employeeRest/updateMpin", "RestAuthenticationController::updateMpin"); -$routes->post("/employeeRest/verifyMpin", "RestAuthenticationController::verifyMpin"); -$routes->post("/employeeRest/checkMpin", "RestAuthenticationController::checkMpin"); -$routes->post("employeeRest/forgotMPIN", "RestAuthenticationController::forgotMPIN"); -$routes->post("employeeRest/updateMobileNumber", "RestAuthenticationController::updateMobileNumber"); -// PASSWORD api's -$routes->post("employeeRest/savePassword", "RestAuthenticationController::savePassword"); -$routes->post("employeeRest/changePassword", "RestAuthenticationController::changePassword"); -$routes->post("employeeRest/verifyPassword", "RestAuthenticationController::verifyPassword"); -$routes->post("employeeRest/verifyOtp", "RestAuthenticationController::verifyOtp"); -$routes->post("employeeRest/checkPassword", "RestAuthenticationController::checkPassword"); -$routes->get("employeeRest/downloadSampleExcel", "EmployeeRestController::downloadSampleExcel"); // $routes->post("employeeRest/createOrUpdateEmployeePolicySiAmount", "EmployeeRestController::createOrUpdateEmployeePolicySiAmount"); // $routes->post("employeeRest/calculatePremium", "EmployeeRestController::calculatePremium"); -$routes->group("employeeRest", ["filter" => "authJWT"], function ($routes) { +$routes->group("employeeRest", ["filter" => ["authJWT" , "appSignature"]], function ($routes) { // $routes->post("getVerifiedUserData", "RestAuthenticationController::getVerifiedUserData"); @@ -525,6 +501,39 @@ $routes->group("employeeRest", ["filter" => "authJWT"], function ($routes) { }); +$routes->group("employeeRest", ['filter' => ["appSignature"] ], function ($routes) { + + //Employee login api's + $routes->post("verifyEmployeeNumber", "RestAuthenticationController::verifyEmployeeWithMobileNumber"); + $routes->post("getVerifiedUserData", "RestAuthenticationController::getVerifiedUserData"); + $routes->post("verifyEmployeeEmailId", "RestAuthenticationController::verifyEmployeeWithEmailId"); + // $routes->post("saveMpin", "RestAuthenticationController::saveMpin"); + + + //HR login api's + $routes->post("verifyHrWithMobileNumber", "RestAuthenticationController::verifyHrWithMobileNumber"); + $routes->post("verifyHrWithEmail", "RestAuthenticationController::verifyHrWithEmail"); + $routes->post("getVerifiedHrData", "RestAuthenticationController::getVerifiedHrData"); + + // MPIN api's + $routes->post("saveMpin", "RestAuthenticationController::saveMpin"); + $routes->post("updateMpin", "RestAuthenticationController::updateMpin"); + $routes->post("verifyMpin", "RestAuthenticationController::verifyMpin"); + $routes->post("checkMpin", "RestAuthenticationController::checkMpin"); + $routes->post("forgotMPIN", "RestAuthenticationController::forgotMPIN"); + $routes->post("updateMobileNumber", "RestAuthenticationController::updateMobileNumber"); + + // PASSWORD api's + $routes->post("savePassword", "RestAuthenticationController::savePassword"); + $routes->post("changePassword", "RestAuthenticationController::changePassword"); + $routes->post("verifyPassword", "RestAuthenticationController::verifyPassword"); + $routes->post("verifyOtp", "RestAuthenticationController::verifyOtp"); + $routes->post("checkPassword", "RestAuthenticationController::checkPassword"); + $routes->get("downloadSampleExcel", "EmployeeRestController::downloadSampleExcel"); + + +}); + $routes->get("getEmployeeActiveOrInactivePolicy", "EmployeeRestController::getEmployeeActiveOrInactivePolicy"); $routes->get("sendPushNotification", "EmployeeRestController::sendPushNotification"); $routes->post("sendEmail", "EmployeeRestController::send_email"); diff --git a/app/Controllers/RestAuthenticationController.php b/app/Controllers/RestAuthenticationController.php index 7531d2e..8507be5 100755 --- a/app/Controllers/RestAuthenticationController.php +++ b/app/Controllers/RestAuthenticationController.php @@ -69,7 +69,10 @@ class RestAuthenticationController extends AdminController { $client = \Config\Services::curlrequest(); $url = env('POST_ENROLLMENT_BASEURL').$endPoint; - $response = $client->post( $url, ['json' => $postData, 'http_errors' => false ] ); + $headers = [ + 'App-Signature' => getenv('APP_SIGNATURE'), + ]; + $response = $client->post( $url, ['json' => $postData, 'headers' => $headers , 'http_errors' => false ] ); // return json_decode($response->getBody(), true); return $response->getBody(); }