Skip to content

Commit

Permalink
Merge pull request #6 from jderusse/deprec
Browse files Browse the repository at this point in the history
  • Loading branch information
qdequippe authored Feb 18, 2022
2 parents 08339cd + 7bd335e commit 0a45bed
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions src/Provider/SymfonyConnect.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

use League\OAuth2\Client\Provider\AbstractProvider;
use League\OAuth2\Client\Provider\Exception\IdentityProviderException;
use League\OAuth2\Client\Provider\ResourceOwnerInterface;
use League\OAuth2\Client\Token\AccessToken;
use Psr\Http\Message\ResponseInterface;

Expand All @@ -12,31 +13,55 @@ class SymfonyConnect extends AbstractProvider

protected $api = 'https://connect.symfony.com';

/**
* @return string
*/
#[\ReturnTypeWillChange]
public function getBaseAuthorizationUrl()
{
return $this->api . '/oauth/authorize';
}

/**
* @return string
*/
#[\ReturnTypeWillChange]
public function getBaseAccessTokenUrl(array $params)
{
return $this->api . '/oauth/access_token';
}

/**
* @return string
*/
#[\ReturnTypeWillChange]
public function getResourceOwnerDetailsUrl(AccessToken $token)
{
return $this->api . '/api?access_token='.$token->getToken();
}

/**
* @return string
*/
#[\ReturnTypeWillChange]
protected function getScopeSeparator()
{
return ' ';
}

/**
* @return array
*/
#[\ReturnTypeWillChange]
protected function getDefaultScopes()
{
return ['SCOPE_PUBLIC'];
}

/**
* @return array
*/
#[\ReturnTypeWillChange]
protected function parseResponse(ResponseInterface $response)
{
$type = $this->getContentType($response);
Expand All @@ -48,6 +73,10 @@ protected function parseResponse(ResponseInterface $response)
return ['xml' => (string)$response->getBody()];
}

/**
* @return void
*/
#[\ReturnTypeWillChange]
protected function checkResponse(ResponseInterface $response, $data)
{
if ($response->getStatusCode() >= 400) {
Expand All @@ -59,6 +88,10 @@ protected function checkResponse(ResponseInterface $response, $data)
}
}

/**
* @return ResourceOwnerInterface
*/
#[\ReturnTypeWillChange]
protected function createResourceOwner(array $response, AccessToken $token)
{
return new SymfonyConnectResourceOwner($response);
Expand Down

0 comments on commit 0a45bed

Please sign in to comment.