Update website

This commit is contained in:
Guilhem Lavaux 2025-02-11 21:30:02 +01:00
parent 0a686aeb9a
commit c4ffa0f6ee
4360 changed files with 1727 additions and 718385 deletions

View file

@ -495,7 +495,7 @@ abstract class AbstractProvider
*/
public function authorize(
array $options = [],
callable $redirectHandler = null
?callable $redirectHandler = null
) {
$url = $this->getAuthorizationUrl($options);
if ($redirectHandler) {
@ -620,6 +620,15 @@ abstract class AbstractProvider
{
$grant = $this->verifyGrant($grant);
if (empty($options['scope'])) {
$options['scope'] = $this->getDefaultScopes();
}
if (is_array($options['scope'])) {
$separator = $this->getScopeSeparator();
$options['scope'] = implode($separator, $options['scope']);
}
$params = [
'client_id' => $this->clientId,
'client_secret' => $this->clientSecret,
@ -757,7 +766,7 @@ abstract class AbstractProvider
*/
protected function getContentType(ResponseInterface $response)
{
return join(';', (array) $response->getHeader('content-type'));
return implode(';', $response->getHeader('content-type'));
}
/**
@ -815,7 +824,7 @@ abstract class AbstractProvider
* Custom mapping of expiration, etc should be done here. Always call the
* parent method when overloading this method.
*
* @param mixed $result
* @param array<string, mixed> $result
* @return array
*/
protected function prepareAccessTokenResponse(array $result)

View file

@ -22,7 +22,7 @@ use RuntimeException;
*
* @link http://tools.ietf.org/html/rfc6749#section-1.4 Access Token (RFC 6749, §1.4)
*/
class AccessToken implements AccessTokenInterface, ResourceOwnerAccessTokenInterface
class AccessToken implements AccessTokenInterface, ResourceOwnerAccessTokenInterface, SettableRefreshTokenInterface
{
/**
* @var string
@ -118,7 +118,7 @@ class AccessToken implements AccessTokenInterface, ResourceOwnerAccessTokenInter
} elseif (!empty($options['expires'])) {
// Some providers supply the seconds until expiration rather than
// the exact timestamp. Take a best guess at which we received.
$expires = $options['expires'];
$expires = (int) $options['expires'];
if (!$this->isExpirationTimestamp($expires)) {
$expires += $this->getTimeNow();
@ -169,6 +169,14 @@ class AccessToken implements AccessTokenInterface, ResourceOwnerAccessTokenInter
return $this->refreshToken;
}
/**
* @inheritdoc
*/
public function setRefreshToken($refreshToken)
{
$this->refreshToken = $refreshToken;
}
/**
* @inheritdoc
*/
@ -196,7 +204,7 @@ class AccessToken implements AccessTokenInterface, ResourceOwnerAccessTokenInter
throw new RuntimeException('"expires" is not set on the token');
}
return $expires < time();
return $expires < $this->getTimeNow();
}
/**

View file

@ -0,0 +1,26 @@
<?php
/**
* This file is part of the league/oauth2-client library
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*
* @copyright Copyright (c) Alex Bilbie <hello@alexbilbie.com>
* @license http://opensource.org/licenses/MIT MIT
* @link http://thephpleague.com/oauth2-client/ Documentation
* @link https://packagist.org/packages/league/oauth2-client Packagist
* @link https://github.com/thephpleague/oauth2-client GitHub
*/
namespace League\OAuth2\Client\Token;
interface SettableRefreshTokenInterface
{
/**
* Sets or replaces the refresh token with the provided refresh token.
*
* @param string $refreshToken
* @return void
*/
public function setRefreshToken($refreshToken);
}