Skip to content

Commit

Permalink
refactor : use wellknown
Browse files Browse the repository at this point in the history
  • Loading branch information
hschoenenberger committed Feb 12, 2024
1 parent 492077c commit 6594853
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/Provider/LogoutTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ trait LogoutTrait
*/
public function getBaseSessionLogoutUrl()
{
return 'https://oauth.prestashop.com/oauth2/sessions/logout';
return $this->wellKnown->end_session_endpoint;
}

/**
Expand Down
33 changes: 30 additions & 3 deletions src/Provider/PrestaShop.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,12 +52,39 @@ class PrestaShop extends AbstractProvider
*/
protected $uiLocales;

/**
* @var WellKnown
*/
protected $wellKnown;

/**
* @param array $options
*
* @param array $collaborators
*
* @throws \Exception
*/
public function __construct(array $options = [], array $collaborators = [])
{
parent::__construct($options, $collaborators);

$this->wellKnown = new WellKnown($this->getOauth2Url(), $options['verify']);
}

/**
* @return string
*/
public function getOauth2Url()
{
return 'https://oauth.prestashop.com';
}

/**
* @return string
*/
public function getBaseAuthorizationUrl()
{
return 'https://oauth.prestashop.com/oauth2/auth';
return $this->wellKnown->authorization_endpoint;
}

/**
Expand All @@ -67,7 +94,7 @@ public function getBaseAuthorizationUrl()
*/
public function getBaseAccessTokenUrl(array $params)
{
return 'https://oauth.prestashop.com/oauth2/token';
return $this->wellKnown->token_endpoint;
}

/**
Expand All @@ -77,7 +104,7 @@ public function getBaseAccessTokenUrl(array $params)
*/
public function getResourceOwnerDetailsUrl(AccessToken $token)
{
return 'https://oauth.prestashop.com/userinfo';
return $this->wellKnown->userinfo_endpoint;
}

/**
Expand Down

0 comments on commit 6594853

Please sign in to comment.