summaryrefslogtreecommitdiff
path: root/server/core/LibOverride/Test.php
diff options
context:
space:
mode:
authorEole <EoleDev@outlook.fr>2016-01-31 04:00:20 +0100
committerEole <EoleDev@outlook.fr>2016-01-31 04:00:20 +0100
commit6c4cdf62ac99a56cefb663ad4779dd07f0944a26 (patch)
tree7a40abe17c2b5de8713bdbd02f89bb2fc2c4e61c /server/core/LibOverride/Test.php
parent7276d3f0334785a33ab23ef80db1e2ea77d24922 (diff)
Test Serialization Token Debut
Diffstat (limited to 'server/core/LibOverride/Test.php')
-rwxr-xr-xserver/core/LibOverride/Test.php43
1 files changed, 37 insertions, 6 deletions
diff --git a/server/core/LibOverride/Test.php b/server/core/LibOverride/Test.php
index 4e8e540..5babc35 100755
--- a/server/core/LibOverride/Test.php
+++ b/server/core/LibOverride/Test.php
@@ -12,15 +12,16 @@ class genTokenOptions
private $optionsGlobal;
private $stack;
+ private $backup = [];
public function __construct($options){
echo "test";
$this->stack = HandlerStack::create();
- $httpClient['Common'] = new Client([
+ $httpClient = new Client([
'base_uri' => Utils::normalizeUrl($options['authUrl']),
- 'handler' => $stack,
+ 'handler' => $this->stack,
]);
$options['identityService'] = Service::factory($httpClient);
@@ -45,26 +46,56 @@ class genTokenOptions
}
}
- public genComputeToken(){
+ public function genComputeToken(){
$options = $this->optionsGlobal['Common'];
$options['catalogName'] = 'nova';
$options['catalogType'] = 'compute';
$options['region'] = 'RegionOne';
list($token, $baseUrl) = $options['identityService']->authenticate($options);
-
+ var_dump($token);
//$stack = HandlerStack::create();
$this->stack->push(Middleware::authHandler($options['authHandler'], $token));
$this->addDebugMiddleware($options, $this->stack);
$options['httpClient'] = new Client([
- 'base_uri' => Utils::normalizeUrl($options['authUrl']),
- 'handler' => $stack,
+ 'base_uri' => Utils::normalizeUrl($baseUrl),
+ 'handler' => $this->stack,
]);
+ $this->backup['Compute'] = array('token' => serialize($token), 'baseUrl' => $baseUrl );
+ $this->optionsGlobal['Compute'] = $options;
+ }
+
+ public function loadComputeBackup($opt){
+
+ $options = $this->optionsGlobal['Common'];
+ $options['catalogName'] = 'nova';
+ $options['catalogType'] = 'compute';
+ $options['region'] = 'RegionOne';
+ //list($token, $baseUrl) = $options['identityService']->authenticate($options);
+ $this->backup['Compute'] = unserialize($opt);
+ $token = unserialize($this->backup['Compute'] ['token']);
+ $baseUrl = $this->backup['Compute']['baseUrl'];
+
+ //$stack = HandlerStack::create();
+
+ $this->stack->push(Middleware::authHandler($options['authHandler'], $token));
+
+ $this->addDebugMiddleware($options, $this->stack);
+
+ $options['httpClient'] = new Client([
+ 'base_uri' => Utils::normalizeUrl($baseUrl),
+ 'handler' => $this->stack,
+ ]);
+ $this->backup['Compute'] = array('token' => serialize($token), 'baseUrl' => $baseUrl );
$this->optionsGlobal['Compute'] = $options;
}
+
+ public function getBackup($service){
+ return serialize($this->backup[$service]);
+ }
public function getOptionsCompute(){
return $this->optionsGlobal['Compute'];