From 33463352403037ad03877f18bc3bdd17a7478d3c Mon Sep 17 00:00:00 2001 From: Eole Date: Sun, 31 Jan 2016 17:53:27 +0100 Subject: [PATCH] Debug TokenGen --- server/core/LibOverride/genTokenOptions.php | 69 +++++++++++++-------- 1 file changed, 43 insertions(+), 26 deletions(-) diff --git a/server/core/LibOverride/genTokenOptions.php b/server/core/LibOverride/genTokenOptions.php index 9cb4100..81ecfc8 100755 --- a/server/core/LibOverride/genTokenOptions.php +++ b/server/core/LibOverride/genTokenOptions.php @@ -33,7 +33,7 @@ class genTokenOptions $options['authHandler'] = function () use ($options) { return $options['identityService']->generateToken($options); }; - + $this->optionsGlobal['Common'] = $options; } @@ -60,13 +60,15 @@ class genTokenOptions $baseUrl = $options["authUrl"]; $token = $options['identityService']->generateToken($options); - $this->stack->push(Middleware::authHandler($options['authHandler'], $token)); + $stack = HandlerStack::create(); - $this->addDebugMiddleware($options, $this->stack); + $stack->push(Middleware::authHandler($options['authHandler'], $token)); + + $this->addDebugMiddleware($options, $stack); $options['httpClient'] = new Client([ 'base_uri' => Utils::normalizeUrl($baseUrl), - 'handler' => $this->stack, + 'handler' => $stack, ]); $this->backup['Identity'] = array('token' => $this->serializeToken($token), 'baseUrl' => $baseUrl ); @@ -82,17 +84,20 @@ class genTokenOptions $this->backup['Identity'] = unserialize($opt); $token = $this->unserializeToken($this->backup['Identity']['token']); $baseUrl = $this->backup['Identity']['baseUrl']; - - $this->stack->push(Middleware::authHandler($options['authHandler'], $token)); - $this->addDebugMiddleware($options, $this->stack); + $stack = HandlerStack::create(); + + $stack->push(Middleware::authHandler($options['authHandler'], $token)); + + $this->addDebugMiddleware($options, $stack); $options['httpClient'] = new Client([ 'base_uri' => Utils::normalizeUrl($baseUrl), - 'handler' => $this->stack, + 'handler' => $stack, ]); $this->backup['Identity'] = array('token' => $this->serializeToken($token), 'baseUrl' => $baseUrl ); $this->optionsGlobal['Identity'] = $options; + } public function genImageToken(){ @@ -103,13 +108,15 @@ class genTokenOptions list($token, $baseUrl) = $options['identityService']->authenticate($options); - $this->stack->push(Middleware::authHandler($options['authHandler'], $token)); + $stack = HandlerStack::create(); - $this->addDebugMiddleware($options, $this->stack); + $stack->push(Middleware::authHandler($options['authHandler'], $token)); + + $this->addDebugMiddleware($options, $stack); $options['httpClient'] = new Client([ 'base_uri' => Utils::normalizeUrl($baseUrl), - 'handler' => $this->stack, + 'handler' => $stack, ]); $this->backup['Image'] = array('token' => $this->serializeToken($token), 'baseUrl' => $baseUrl ); @@ -126,13 +133,15 @@ class genTokenOptions $token = $this->unserializeToken($this->backup['Image']['token']); $baseUrl = $this->backup['Image']['baseUrl']; - $this->stack->push(Middleware::authHandler($options['authHandler'], $token)); + $stack = HandlerStack::create(); - $this->addDebugMiddleware($options, $this->stack); + $stack->push(Middleware::authHandler($options['authHandler'], $token)); + + $this->addDebugMiddleware($options, $stack); $options['httpClient'] = new Client([ 'base_uri' => Utils::normalizeUrl($baseUrl), - 'handler' => $this->stack, + 'handler' => $stack, ]); $this->backup['Image'] = array('token' => $this->serializeToken($token), 'baseUrl' => $baseUrl ); $this->optionsGlobal['Image'] = $options; @@ -146,13 +155,15 @@ class genTokenOptions list($token, $baseUrl) = $options['identityService']->authenticate($options); - $this->stack->push(Middleware::authHandler($options['authHandler'], $token)); + $stack = HandlerStack::create(); - $this->addDebugMiddleware($options, $this->stack); + $stack->push(Middleware::authHandler($options['authHandler'], $token)); + + $this->addDebugMiddleware($options, $stack); $options['httpClient'] = new Client([ 'base_uri' => Utils::normalizeUrl($baseUrl), - 'handler' => $this->stack, + 'handler' => $stack, ]); $this->backup['Network'] = array('token' => $this->serializeToken($token), 'baseUrl' => $baseUrl ); @@ -169,13 +180,15 @@ class genTokenOptions $token = $this->unserializeToken($this->backup['Network']['token']); $baseUrl = $this->backup['Network']['baseUrl']; - $this->stack->push(Middleware::authHandler($options['authHandler'], $token)); + $stack = HandlerStack::create(); + + $stack->push(Middleware::authHandler($options['authHandler'], $token)); - $this->addDebugMiddleware($options, $this->stack); + $this->addDebugMiddleware($options, $stack); $options['httpClient'] = new Client([ 'base_uri' => Utils::normalizeUrl($baseUrl), - 'handler' => $this->stack, + 'handler' => $stack, ]); $this->backup['Network'] = array('token' => $this->serializeToken($token), 'baseUrl' => $baseUrl ); $this->optionsGlobal['Network'] = $options; @@ -189,13 +202,15 @@ class genTokenOptions list($token, $baseUrl) = $options['identityService']->authenticate($options); - $this->stack->push(Middleware::authHandler($options['authHandler'], $token)); + $stack = HandlerStack::create(); - $this->addDebugMiddleware($options, $this->stack); + $stack->push(Middleware::authHandler($options['authHandler'], $token)); + + $this->addDebugMiddleware($options, $stack); $options['httpClient'] = new Client([ 'base_uri' => Utils::normalizeUrl($baseUrl), - 'handler' => $this->stack, + 'handler' => $stack, ]); $this->backup['Compute'] = array('token' => $this->serializeToken($token), 'baseUrl' => $baseUrl ); @@ -213,13 +228,15 @@ class genTokenOptions $token = $this->unserializeToken($this->backup['Compute']['token']); $baseUrl = $this->backup['Compute']['baseUrl']; - $this->stack->push(Middleware::authHandler($options['authHandler'], $token)); + $stack = HandlerStack::create(); + + $stack->push(Middleware::authHandler($options['authHandler'], $token)); - $this->addDebugMiddleware($options, $this->stack); + $this->addDebugMiddleware($options, $stack); $options['httpClient'] = new Client([ 'base_uri' => Utils::normalizeUrl($baseUrl), - 'handler' => $this->stack, + 'handler' => $stack, ]); $this->backup['Compute'] = array('token' => $this->serializeToken($token), 'baseUrl' => $baseUrl ); $this->optionsGlobal['Compute'] = $options;