diff options
author | Manuel Jiménez Friaza <mjfriaza@openmailbox.org> | 2019-01-20 12:58:27 +0100 |
---|---|---|
committer | Manuel Jiménez Friaza <mjfriaza@openmailbox.org> | 2019-01-20 12:58:27 +0100 |
commit | 4e8fc6d19851b6d05a49d5151aaa1f0f1fcfb5c0 (patch) | |
tree | 49111cffad0616616f4ce76fed9dd6b4fad8e41f /vendor/bshaffer/oauth2-server-php/src/OAuth2 | |
parent | 618d673947dc627dcdac3f9b6da7f31123472b05 (diff) | |
parent | 39128c34ccf48cc23ed368cf5bbedd71b5ef75db (diff) | |
download | volse-hubzilla-4e8fc6d19851b6d05a49d5151aaa1f0f1fcfb5c0.tar.gz volse-hubzilla-4e8fc6d19851b6d05a49d5151aaa1f0f1fcfb5c0.tar.bz2 volse-hubzilla-4e8fc6d19851b6d05a49d5151aaa1f0f1fcfb5c0.zip |
Merge remote-tracking branch 'upstream/dev' into dev
Diffstat (limited to 'vendor/bshaffer/oauth2-server-php/src/OAuth2')
4 files changed, 29 insertions, 7 deletions
diff --git a/vendor/bshaffer/oauth2-server-php/src/OAuth2/Request.php b/vendor/bshaffer/oauth2-server-php/src/OAuth2/Request.php index c96cb972f..f547bf6e8 100644 --- a/vendor/bshaffer/oauth2-server-php/src/OAuth2/Request.php +++ b/vendor/bshaffer/oauth2-server-php/src/OAuth2/Request.php @@ -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); } /** diff --git a/vendor/bshaffer/oauth2-server-php/src/OAuth2/Response.php b/vendor/bshaffer/oauth2-server-php/src/OAuth2/Response.php index ccd797ae7..88c1ad5f7 100644 --- a/vendor/bshaffer/oauth2-server-php/src/OAuth2/Response.php +++ b/vendor/bshaffer/oauth2-server-php/src/OAuth2/Response.php @@ -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); } diff --git a/vendor/bshaffer/oauth2-server-php/src/OAuth2/ResponseType/JwtAccessToken.php b/vendor/bshaffer/oauth2-server-php/src/OAuth2/ResponseType/JwtAccessToken.php index 0af9705ff..0ee3708aa 100644 --- a/vendor/bshaffer/oauth2-server-php/src/OAuth2/ResponseType/JwtAccessToken.php +++ b/vendor/bshaffer/oauth2-server-php/src/OAuth2/ResponseType/JwtAccessToken.php @@ -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; } } diff --git a/vendor/bshaffer/oauth2-server-php/src/OAuth2/Server.php b/vendor/bshaffer/oauth2-server-php/src/OAuth2/Server.php index 62ae8970d..cf040c2bc 100644 --- a/vendor/bshaffer/oauth2-server-php/src/OAuth2/Server.php +++ b/vendor/bshaffer/oauth2-server-php/src/OAuth2/Server.php @@ -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; } -}
\ No newline at end of file +} |