diff --git a/src/Provider/LogoutTrait.php b/src/Provider/LogoutTrait.php index a7f0d88..b06fec6 100644 --- a/src/Provider/LogoutTrait.php +++ b/src/Provider/LogoutTrait.php @@ -14,7 +14,7 @@ trait LogoutTrait */ public function getBaseSessionLogoutUrl() { - return 'https://oauth.prestashop.com/oauth2/sessions/logout'; + return $this->wellKnown->end_session_endpoint; } /** diff --git a/src/Provider/PrestaShop.php b/src/Provider/PrestaShop.php index 7be8900..7894238 100644 --- a/src/Provider/PrestaShop.php +++ b/src/Provider/PrestaShop.php @@ -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; } /** @@ -67,7 +94,7 @@ public function getBaseAuthorizationUrl() */ public function getBaseAccessTokenUrl(array $params) { - return 'https://oauth.prestashop.com/oauth2/token'; + return $this->wellKnown->token_endpoint; } /** @@ -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; } /**