Skip to content

Commit

Permalink
feat : verify option
Browse files Browse the repository at this point in the history
  • Loading branch information
hschoenenberger committed Feb 12, 2024
1 parent 6594853 commit 46c78ca
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 6 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 $this->wellKnown->end_session_endpoint;
return $this->getWellKnown()->end_session_endpoint;
}

/**
Expand Down
28 changes: 23 additions & 5 deletions src/Provider/PrestaShop.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,11 @@ class PrestaShop extends AbstractProvider
*/
protected $wellKnown;

/**
* @var bool
*/
protected $verify = true;

/**
* @param array $options
*
Expand All @@ -67,8 +72,6 @@ class PrestaShop extends AbstractProvider
public function __construct(array $options = [], array $collaborators = [])
{
parent::__construct($options, $collaborators);

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

/**
Expand All @@ -79,12 +82,27 @@ public function getOauth2Url()
return 'https://oauth.prestashop.com';
}

/**
* @return WellKnown
*/
public function getWellKnown()
{
if (! $this->wellKnown) {

Check failure on line 90 in src/Provider/PrestaShop.php

View workflow job for this annotation

GitHub Actions / PHPStan

Negated boolean expression is always false.

Check failure on line 90 in src/Provider/PrestaShop.php

View workflow job for this annotation

GitHub Actions / PHPStan

Negated boolean expression is always false.
try {
$this->wellKnown = new WellKnown($this->getOauth2Url(), $this->verify);
} catch (\Exception $e) {
$this->wellKnown = new WellKnown();
}
}
return $this->wellKnown;
}

/**
* @return string
*/
public function getBaseAuthorizationUrl()
{
return $this->wellKnown->authorization_endpoint;
return $this->getWellKnown()->authorization_endpoint;
}

/**
Expand All @@ -94,7 +112,7 @@ public function getBaseAuthorizationUrl()
*/
public function getBaseAccessTokenUrl(array $params)
{
return $this->wellKnown->token_endpoint;
return $this->getWellKnown()->token_endpoint;
}

/**
Expand All @@ -104,7 +122,7 @@ public function getBaseAccessTokenUrl(array $params)
*/
public function getResourceOwnerDetailsUrl(AccessToken $token)
{
return $this->wellKnown->userinfo_endpoint;
return $this->getWellKnown()->userinfo_endpoint;
}

/**
Expand Down

0 comments on commit 46c78ca

Please sign in to comment.