Begin of Identity Implementation, Begin of Token management for Identification
This commit is contained in:
parent
ba8bbc77fb
commit
78e6e5787c
8 changed files with 335 additions and 9 deletions
63
server/core/LibOverride/Test.php
Normal file
63
server/core/LibOverride/Test.php
Normal file
|
@ -0,0 +1,63 @@
|
|||
<?php
|
||||
|
||||
class genTokenOptions
|
||||
{
|
||||
private $clientHTTP;
|
||||
|
||||
public function __construct(){
|
||||
|
||||
//IdentityService?
|
||||
// $options['IdentityService'] pas oblige?...
|
||||
// creer HttpClient authurl HandlerStack::create()
|
||||
// $option['identityService'] = factory httpClient
|
||||
//AuthHadler?
|
||||
//
|
||||
//StockClient?
|
||||
// creer $options['httpClient'] instance de ClientInterface
|
||||
// token, baseUrl = identity->authenticate
|
||||
// stack = getStack authhandler token
|
||||
// addDebug??
|
||||
// $options['httpClient'] = httpCLient baseurl stack
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @codeCoverageIgnore
|
||||
*/
|
||||
private function addDebugMiddleware(array $options, HandlerStack &$stack)
|
||||
{
|
||||
if (!empty($options['debugLog'])
|
||||
&& !empty($options['logger'])
|
||||
&& !empty($options['messageFormatter'])
|
||||
) {
|
||||
$stack->push(GuzzleMiddleware::log($options['logger'], $options['messageFormatter']));
|
||||
}
|
||||
}
|
||||
/**
|
||||
* @param array $options
|
||||
* @codeCoverageIgnore
|
||||
*/
|
||||
private function stockAuthHandler(array &$options)
|
||||
{
|
||||
if (!isset($options['authHandler'])) {
|
||||
$options['authHandler'] = function () use ($options) {
|
||||
return $options['identityService']->generateToken($options);
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
private function getStack(callable $authHandler, Token $token = null)
|
||||
{
|
||||
$stack = HandlerStack::create();
|
||||
$stack->push(Middleware::authHandler($authHandler, $token));
|
||||
return $stack;
|
||||
}
|
||||
|
||||
private function httpClient($baseUrl, HandlerStack $stack)
|
||||
{
|
||||
return new Client([
|
||||
'base_uri' => Utils::normalizeUrl($baseUrl),
|
||||
'handler' => $stack,
|
||||
]);
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue