PHP Class Overtrue\Socialite\Providers\AbstractProvider

Inheritance: implements Overtrue\Socialite\ProviderInterface
Afficher le fichier Open project: overtrue/socialite Class Usage Examples

Protected Properties

Свойство Type Description
$clientId string The client ID.
$clientSecret string The client secret.
$config Overtrue\Socialite\Config The configuration.
$encodingType The type of the encoding in the query.
$parameters array The custom parameters to be sent with the request.
$redirectUrl string The redirect URL.
$request Symfony\Component\HttpFoundation\Request The HTTP request instance.
$scopeSeparator string The separating character for the requested scopes.
$scopes array The scopes being requested.
$stateless boolean Indicates if the session state should be utilized.

Méthodes publiques

Méthode Description
__construct ( Request $request, Config $config, string $clientId, string $clientSecret, string | null $redirectUrl = null ) Create a new provider instance.
getAccessToken ( string $code ) : AccessToken Get the access token for the given code.
getRedirectUrl ( ) : string Return the redirect url.
getRequest ( ) : Request Get the request instance.
redirect ( string $redirectUrl = null ) : RedirectResponse Redirect the user of the application to the provider's authentication screen.
scopes ( array $scopes ) Set the scopes of the requested access.
setRedirectUrl ( string $redirectUrl ) Set redirect url.
setRequest ( Request $request ) Set the request instance.
stateless ( ) Indicates that the provider should operate as stateless.
user ( Overtrue\Socialite\AccessTokenInterface $token = null )
with ( array $parameters ) Set the custom parameters of the request.
withRedirectUrl ( string $redirectUrl ) Set redirect url.

Méthodes protégées

Méthode Description
arrayItem ( array $array, string $key, mixed $default = null ) : mixed Return array item by key.
buildAuthUrlFromBase ( string $url, string $state ) : string Get the authentication URL for the provider.
formatScopes ( array $scopes, string $scopeSeparator ) : string Format the given scopes.
getAuthUrl ( string $state ) : string Get the authentication URL for the provider.
getCode ( ) : string Get the code from the request.
getCodeFields ( string | null $state = null ) : array Get the GET parameters for the code request.
getHttpClient ( ) : Client Get a fresh instance of the Guzzle HTTP client.
getTokenFields ( string $code ) : array Get the POST fields for the token request.
getTokenUrl ( ) : string Get the token URL for the provider.
getUserByToken ( Overtrue\Socialite\AccessTokenInterface $token ) : array Get the raw user for the given access token.
hasInvalidState ( ) : boolean Determine if the current request / session has a mismatching "state".
isStateless ( ) : boolean Determine if the provider is operating as stateless.
mapUserToObject ( array $user ) : Overtrue\Socialite\User Map the raw user array to a Socialite User instance.
parseAccessToken ( Psr\Http\Message\StreamInterface | array $body ) : AccessToken Get the access token from the token response body.
usesState ( ) : boolean Determine if the provider is operating with state.

Method Details

__construct() public méthode

Create a new provider instance.
public __construct ( Request $request, Config $config, string $clientId, string $clientSecret, string | null $redirectUrl = null )
$request Symfony\Component\HttpFoundation\Request
$config Overtrue\Socialite\Config
$clientId string
$clientSecret string
$redirectUrl string | null

arrayItem() protected méthode

Return array item by key.
protected arrayItem ( array $array, string $key, mixed $default = null ) : mixed
$array array
$key string
$default mixed
Résultat mixed

buildAuthUrlFromBase() protected méthode

Get the authentication URL for the provider.
protected buildAuthUrlFromBase ( string $url, string $state ) : string
$url string
$state string
Résultat string

formatScopes() protected méthode

Format the given scopes.
protected formatScopes ( array $scopes, string $scopeSeparator ) : string
$scopes array
$scopeSeparator string
Résultat string

getAccessToken() public méthode

Get the access token for the given code.
public getAccessToken ( string $code ) : AccessToken
$code string
Résultat Overtrue\Socialite\AccessToken

getAuthUrl() abstract protected méthode

Get the authentication URL for the provider.
abstract protected getAuthUrl ( string $state ) : string
$state string
Résultat string

getCode() protected méthode

Get the code from the request.
protected getCode ( ) : string
Résultat string

getCodeFields() protected méthode

Get the GET parameters for the code request.
protected getCodeFields ( string | null $state = null ) : array
$state string | null
Résultat array

getHttpClient() protected méthode

Get a fresh instance of the Guzzle HTTP client.
protected getHttpClient ( ) : Client
Résultat GuzzleHttp\Client

getRedirectUrl() public méthode

Return the redirect url.
public getRedirectUrl ( ) : string
Résultat string

getRequest() public méthode

Get the request instance.
public getRequest ( ) : Request
Résultat Symfony\Component\HttpFoundation\Request

getTokenFields() protected méthode

Get the POST fields for the token request.
protected getTokenFields ( string $code ) : array
$code string
Résultat array

getTokenUrl() abstract protected méthode

Get the token URL for the provider.
abstract protected getTokenUrl ( ) : string
Résultat string

getUserByToken() abstract protected méthode

Get the raw user for the given access token.
abstract protected getUserByToken ( Overtrue\Socialite\AccessTokenInterface $token ) : array
$token Overtrue\Socialite\AccessTokenInterface
Résultat array

hasInvalidState() protected méthode

Determine if the current request / session has a mismatching "state".
protected hasInvalidState ( ) : boolean
Résultat boolean

isStateless() protected méthode

Determine if the provider is operating as stateless.
protected isStateless ( ) : boolean
Résultat boolean

mapUserToObject() abstract protected méthode

Map the raw user array to a Socialite User instance.
abstract protected mapUserToObject ( array $user ) : Overtrue\Socialite\User
$user array
Résultat Overtrue\Socialite\User

parseAccessToken() protected méthode

Get the access token from the token response body.
protected parseAccessToken ( Psr\Http\Message\StreamInterface | array $body ) : AccessToken
$body Psr\Http\Message\StreamInterface | array
Résultat Overtrue\Socialite\AccessToken

redirect() public méthode

Redirect the user of the application to the provider's authentication screen.
public redirect ( string $redirectUrl = null ) : RedirectResponse
$redirectUrl string
Résultat Symfony\Component\HttpFoundation\RedirectResponse

scopes() public méthode

Set the scopes of the requested access.
public scopes ( array $scopes )
$scopes array

setRedirectUrl() public méthode

Set redirect url.
public setRedirectUrl ( string $redirectUrl )
$redirectUrl string

setRequest() public méthode

Set the request instance.
public setRequest ( Request $request )
$request Symfony\Component\HttpFoundation\Request

stateless() public méthode

Indicates that the provider should operate as stateless.
public stateless ( )

user() public méthode

public user ( Overtrue\Socialite\AccessTokenInterface $token = null )
$token Overtrue\Socialite\AccessTokenInterface

usesState() protected méthode

Determine if the provider is operating with state.
protected usesState ( ) : boolean
Résultat boolean

with() public méthode

Set the custom parameters of the request.
public with ( array $parameters )
$parameters array

withRedirectUrl() public méthode

Set redirect url.
public withRedirectUrl ( string $redirectUrl )
$redirectUrl string

Property Details

$clientId protected_oe property

The client ID.
protected string $clientId
Résultat string

$clientSecret protected_oe property

The client secret.
protected string $clientSecret
Résultat string

$config protected_oe property

The configuration.
protected Config,Overtrue\Socialite $config
Résultat Overtrue\Socialite\Config

$encodingType protected_oe property

The type of the encoding in the query.
protected $encodingType

$parameters protected_oe property

The custom parameters to be sent with the request.
protected array $parameters
Résultat array

$redirectUrl protected_oe property

The redirect URL.
protected string $redirectUrl
Résultat string

$request protected_oe property

The HTTP request instance.
protected Request,Symfony\Component\HttpFoundation $request
Résultat Symfony\Component\HttpFoundation\Request

$scopeSeparator protected_oe property

The separating character for the requested scopes.
protected string $scopeSeparator
Résultat string

$scopes protected_oe property

The scopes being requested.
protected array $scopes
Résultat array

$stateless protected_oe property

Indicates if the session state should be utilized.
protected bool $stateless
Résultat boolean