From 159f715410e12a8feffa00399521e17f4b4c7393 Mon Sep 17 00:00:00 2001 From: Bubka <858858+Bubka@users.noreply.github.com> Date: Wed, 25 Sep 2024 08:40:08 +0200 Subject: [PATCH] Clean & Complete OpenID provider --- app/Providers/Socialite/OpenId.php | 27 ++++++--------------------- 1 file changed, 6 insertions(+), 21 deletions(-) diff --git a/app/Providers/Socialite/OpenId.php b/app/Providers/Socialite/OpenId.php index 299d0aa3..33d30289 100644 --- a/app/Providers/Socialite/OpenId.php +++ b/app/Providers/Socialite/OpenId.php @@ -4,10 +4,11 @@ use GuzzleHttp\RequestOptions; use Illuminate\Http\Request; +use Laravel\Socialite\Two\ProviderInterface; use SocialiteProviders\Manager\OAuth2\AbstractProvider; use SocialiteProviders\Manager\OAuth2\User; -class OpenId extends AbstractProvider +class OpenId extends AbstractProvider implements ProviderInterface { public const IDENTIFIER = 'OPENID'; @@ -21,9 +22,11 @@ class OpenId extends AbstractProvider */ public function __construct(Request $request, $clientId, $clientSecret, $redirectUrl, $guzzle = []) { - parent::__construct($request, $clientId, $clientSecret, $redirectUrl, [ + $guzzle = array_merge([ 'proxy' => config('2fauth.config.outgoingProxy') - ]); + ], $guzzle); + + parent::__construct($request, $clientId, $clientSecret, $redirectUrl, $guzzle); } /** @@ -64,24 +67,6 @@ protected function getUserByToken($token) return json_decode((string) $response->getBody(), true); } - /** - * {@inheritdoc} - */ - public function refreshToken($refreshToken) - { - return $this->getHttpClient()->post( /** @phpstan-ignore-line */ - $this->getTokenUrl(), - [ - RequestOptions::FORM_PARAMS => [ - 'client_id' => $this->clientId, - 'client_secret' => $this->clientSecret, - 'grant_type' => 'refresh_token', - 'refresh_token' => $refreshToken, - ], - ] - ); - } - /** * {@inheritdoc} */