mirror of
https://github.com/Bubka/2FAuth.git
synced 2024-11-22 00:03:09 +01:00
Clean & Complete OpenID provider
This commit is contained in:
parent
cd64f10a3c
commit
159f715410
@ -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}
|
||||
*/
|
||||
|
Loading…
Reference in New Issue
Block a user