summaryrefslogtreecommitdiff
path: root/server/core/App.php
diff options
context:
space:
mode:
authorYoggzo <yogg@epsina.com>2016-02-08 17:10:24 +0100
committerYoggzo <yogg@epsina.com>2016-02-08 17:10:24 +0100
commitf1585a13323d408b6917a514bed1920aec3780f0 (patch)
treeb98a23443d20af008cbb8eca16a7aff7c9aa823c /server/core/App.php
parent43b65e1dbb53300d076f5885b5393ff68e248dd1 (diff)
parent1cd1ae92f414573942262f65dc1644e8ff9bb8f6 (diff)
Merge branch 'develop' into Evan
mise a jour
Diffstat (limited to 'server/core/App.php')
-rwxr-xr-xserver/core/App.php68
1 files changed, 68 insertions, 0 deletions
diff --git a/server/core/App.php b/server/core/App.php
new file mode 100755
index 0000000..45f6922
--- /dev/null
+++ b/server/core/App.php
@@ -0,0 +1,68 @@
+<?php
+include_once("core/Plugin_Api.php");
+include_once("core/LibOverride/genTokenOptions.php");
+
+class App{
+
+ protected $openstack;
+ protected $pluginsApi;
+ protected $tokenClass;
+ protected $tokenPost;
+ protected $output;
+
+ public function __construct($args){
+
+ $this->tokenPost = NULL;
+ $this->tokenClass = new genTokenOptions($args);
+ $this->openstack = new OpenStack\OpenStack([]);
+ $this->pluginsApi = plugin_api::getInstance();
+ $this->output = array();
+
+ }
+
+ public function setToken($token){
+
+ $this->tokenPost = $token;
+ $this->tokenClass->loadBackup($his->tokenPost);
+
+ }
+
+ public function getLibClass($service){
+
+ switch($service){
+ case "Identity":
+ if($tokenPost == NULL) $tokenClass->genIdentityToken();
+ $opt = $tokenClass->getOptions($service);
+ return $this->openstack->identityV3($opt);
+ break;
+ }
+
+ }
+
+ public function authenticate(){
+
+ try{
+ $this->tokenClass->genIdentityToken();
+ $this->tokenClass->genComputeToken();
+ $this->tokenClass->genImageToken();
+ $this->tokenClass->genNetworkToken();
+
+ $this->setOutput("token", $this->tokenClass->getBackup());
+ }catch(Exception $e){
+ echo $e;
+ exit();
+ }
+
+ }
+
+ public function setOutput($key, $out){
+
+ $this->output[$key] = $out;
+
+ }
+
+ public function show(){
+ echo json_encode($this->output);
+ }
+
+} \ No newline at end of file