update composer libs

This commit is contained in:
Mario Vavti
2019-01-02 22:41:03 +01:00
parent a19563e139
commit dbd230da74
18 changed files with 364 additions and 148 deletions

View File

@@ -64,7 +64,12 @@ class Request implements RequestInterface
$this->files = $files;
$this->server = $server;
$this->content = $content;
$this->headers = is_null($headers) ? $this->getHeadersFromServer($this->server) : $headers;
if ($headers === null) {
$headers = array();
}
$this->headers = $headers + $this->getHeadersFromServer($this->server);
}
/**

View File

@@ -366,7 +366,7 @@ class Response implements ResponseInterface
if (count($this->parameters) > 0) {
// add parameters to URL redirection
$parts = parse_url($url);
$sep = isset($parts['query']) && count($parts['query']) > 0 ? '&' : '?';
$sep = isset($parts['query']) && !empty($parts['query']) ? '&' : '?';
$url .= $sep . http_build_query($this->parameters);
}

View File

@@ -128,7 +128,7 @@ class JwtAccessToken extends AccessToken
$expires = time() + $this->config['access_lifetime'];
$id = $this->generateAccessToken();
return array(
$payload = array(
'id' => $id, // for BC (see #591)
'jti' => $id,
'iss' => $this->config['issuer'],
@@ -139,5 +139,21 @@ class JwtAccessToken extends AccessToken
'token_type' => $this->config['token_type'],
'scope' => $scope
);
if (isset($this->config['jwt_extra_payload_callable'])) {
if (!is_callable($this->config['jwt_extra_payload_callable'])) {
throw new \InvalidArgumentException('jwt_extra_payload_callable is not callable');
}
$extra = call_user_func($this->config['jwt_extra_payload_callable'], $client_id, $user_id, $scope);
if (!is_array($extra)) {
throw new \InvalidArgumentException('jwt_extra_payload_callable must return array');
}
$payload = array_merge($extra, $payload);
}
return $payload;
}
}

View File

@@ -88,12 +88,12 @@ class Server implements ResourceControllerInterface,
/**
* @var array
*/
protected $grantTypes = [];
protected $grantTypes = array();
/**
* @var array
*/
protected $responseTypes = [];
protected $responseTypes = array();
/**
* @var TokenTypeInterface
@@ -161,6 +161,7 @@ class Server implements ResourceControllerInterface,
// merge all config values. These get passed to our controller objects
$this->config = array_merge(array(
'use_jwt_access_tokens' => false,
'jwt_extra_payload_callable' => null,
'store_encrypted_token_string' => true,
'use_openid_connect' => false,
'id_lifetime' => 3600,
@@ -840,7 +841,7 @@ class Server implements ResourceControllerInterface,
$refreshStorage = $this->storages['refresh_token'];
}
$config = array_intersect_key($this->config, array_flip(explode(' ', 'store_encrypted_token_string issuer access_lifetime refresh_token_lifetime')));
$config = array_intersect_key($this->config, array_flip(explode(' ', 'store_encrypted_token_string issuer access_lifetime refresh_token_lifetime jwt_extra_payload_callable')));
return new JwtAccessToken($this->storages['public_key'], $tokenStorage, $refreshStorage, $config);
}
@@ -1015,4 +1016,4 @@ class Server implements ResourceControllerInterface,
{
return isset($this->config[$name]) ? $this->config[$name] : $default;
}
}
}