summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--server/config.inc.php1
-rwxr-xr-xserver/core/App.php4
-rwxr-xr-xserver/core/LibOverride/genTokenOptions.php10
-rwxr-xr-xserver/index.php5
4 files changed, 18 insertions, 2 deletions
diff --git a/server/config.inc.php b/server/config.inc.php
index 9767c72..636ee5e 100644
--- a/server/config.inc.php
+++ b/server/config.inc.php
@@ -5,6 +5,7 @@
$config["modules_enabled"] = "";
$config["urlAuth"] = "http://148.60.11.31:5000/v3";
+ $config["tokenTime"] = 60 //miunte = 60 //miuntess
?>
diff --git a/server/core/App.php b/server/core/App.php
index d35ccc0..e3c9c22 100755
--- a/server/core/App.php
+++ b/server/core/App.php
@@ -37,6 +37,10 @@ class App{
}
+ public function checkToken(){
+ $this->tokenClass->checkToken();
+ }
+
public function getLibClass($service){
switch($service){
diff --git a/server/core/LibOverride/genTokenOptions.php b/server/core/LibOverride/genTokenOptions.php
index bdae8a6..028226a 100755
--- a/server/core/LibOverride/genTokenOptions.php
+++ b/server/core/LibOverride/genTokenOptions.php
@@ -49,6 +49,12 @@ class genTokenOptions
$stack->push(GuzzleMiddleware::log($options['logger'], $options['messageFormatter']));
}
}
+
+ public function checkToken(){
+
+ return $this->backup['time'] > time();
+
+ }
public function genIdentityToken(){
$options = $this->optionsGlobal['Common'];
@@ -271,6 +277,7 @@ class genTokenOptions
$path = "core/LibOverride/projectTokenData/".$token['saved']["project"]["name"];
//error_log(print_r($path, true), 0);
file_put_contents("core/LibOverride/projectTokenData/".$token['saved']["project"]["name"], serialize($token['saved']));
+ $this->backup['time'] = $token['time'];
$this->backup["roles"] = $token["roles"];
$this->backup["project"] = $token['saved']["project"]["name"];
$this->backup["user"] = $token["user"];
@@ -284,7 +291,7 @@ class genTokenOptions
public function loadBackup($back){
$backup = unserialize($back);
-
+ $this->backup['time'] = $backup['time'];
$this->backup["roles"] = $backup["roles"];
$this->backup["project"] = $backup["project"];
$this->backup["user"] = $backup["user"];
@@ -343,6 +350,7 @@ class genTokenOptions
$tokenSerialized["user"]["name"] = serialize($token->user->name);
$tokenSerialized["token"]["issued"] = serialize($token->issued);
$tokenSerialized["token"]["id"] = serialize($token->id);
+ $tokenSerialized['time'] = time()+$config['tokenTime']*60;
return $tokenSerialized;
}
diff --git a/server/index.php b/server/index.php
index 31feb08..4e9c82b 100755
--- a/server/index.php
+++ b/server/index.php
@@ -22,7 +22,7 @@
$App->deauthenticate();
$App->show();
- }else{
+ }else if($App->checkToken()){
switch($task)
{
case "identity":
@@ -54,6 +54,9 @@
break;
}
+ }else{
+ $App->setOuptut("Error", "Token Invalide");
+ $App->show();
}