From 47ef4864379588ff087bd48ab081c15e37c12b2f Mon Sep 17 00:00:00 2001 From: Nathanael Jourdane Date: Fri, 17 Nov 2017 15:16:16 +0100 Subject: [PATCH] Set timeLimit in config.php and set it to 10minutes. --- php/classes/WebServer.php | 8 +++++--- php/config.php | 3 +++ php/rest/auth.php | 2 +- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/php/classes/WebServer.php b/php/classes/WebServer.php index 3c05fce..0bae591 100644 --- a/php/classes/WebServer.php +++ b/php/classes/WebServer.php @@ -5,6 +5,9 @@ * * @version $Id: WebServer.php 2968 2015-06-29 13:17:00Z natacha $ */ + +require_once '../config.php'; + class WebResultMgr { private $resDOM; @@ -83,7 +86,6 @@ class WebServer private $wsUserMgr; private $resultMgr, $myParamsInfoMgr; private $dataFileName; - private $timeLimitQuery; // Time interval between 2 queries before to ask for a new authentification, in seconds. function __construct() { $this->userID = 'impex'; @@ -91,7 +93,6 @@ class WebServer $this->sessionID = $this->userID; $this->myParamsInfoMgr = new ParamsInfoMgr(); $this->resultMgr = new WebResultMgr(); - $this->timeLimitQuery = 30; } protected function init($data) { @@ -551,7 +552,8 @@ class WebServer public function getNewToken() { $timeStamp = (new DateTime())->getTimestamp(); - $newToken = md5((int)($timeStamp/30)); + // generate token from timeStamp and some salt + $newToken = md5(1321 * (int)($timeStamp/timeLimitQuery)); return array('success' => true, 'token' => $newToken); } diff --git a/php/config.php b/php/config.php index 9400594..3cd931a 100644 --- a/php/config.php +++ b/php/config.php @@ -118,6 +118,9 @@ $SERVER_NAME = $_SERVER['SERVER_NAME'] ? $_SERVER['SERVER_NAME'] : gethostname( define('webAlias',"http://".$SERVER_NAME.APACHE_ALIAS); define('wsdl_AMDA', webAlias."public/wsdl/Methods_AMDA.wsdl"); + +// Time interval between 2 queries before to ask for a new authentification, in seconds. +define ('timeLimitQuery', 600); /*-------------------END WEB SERVICES section ---------*/ // AKKA - KERNELBIN is now the new kernel bin dir diff --git a/php/rest/auth.php b/php/rest/auth.php index 515a2ce..da2f819 100644 --- a/php/rest/auth.php +++ b/php/rest/auth.php @@ -12,7 +12,7 @@ require_once '../config.php'; $amda_ws = new WebServer(); - $result = $amda_ws->auth($_GET); + $result = $amda_ws->getNewToken($_GET); if ($result['success']){ echo $result['token']; -- libgit2 0.21.2