AbstractProvider
abstract class AbstractProvider extends AbstractProvider implements Provider
Traits
Properties
| protected string|null | $contextNamespace | The unique context namespace for this provider instance. |
from HasProviderContext |
| protected array | $parameters | The custom parameters to be sent with the request. |
from AbstractProvider |
| protected bool | $stateless | Indicates if the session state should be utilized. |
from AbstractProvider |
| protected array | $additionalConfig | The provider's baseline configuration. |
from AbstractProvider |
| protected array | $scopes | The scopes being requested. |
|
| protected string | $scopeSeparator | The separating character for the requested scopes. |
|
| protected int | $encodingType | The type of the encoding in the query. |
|
| protected bool | $usesPKCE | Indicates if PKCE should be used. |
Methods
Create a new provider instance.
Set the baseline provider configuration.
Override provider configuration for the current request.
Get a value from the provider configuration.
Set the Guzzle HTTP client instance.
Indicate that the provider should operate as stateless.
Set the custom parameters of the request.
Get the authentication URL for the provider.
Get the token URL for the provider.
Get the raw user for the given access token.
Map the raw user array to a Socialite User instance.
Redirect the user of the application to the provider's authentication screen.
Build the authentication URL for the provider from the given base URL.
Get the GET parameters for the code request.
Format the given scopes.
Create a user instance from the given data.
Get a Social User instance from a known access token.
Determine if the current request / session has a mismatching "state".
Get the access token response for the given code.
Get the headers for the access token request.
Get the POST fields for the token request.
Refresh a user's access token with a refresh token.
Get the refresh token response for the given refresh token.
Get the code from the request.
Merge the scopes of the requested access.
Set the scopes of the requested access.
Get the current scopes.
Set the redirect URL.
Get the redirect URL.
Get the client ID.
Get the client secret.
Determine if the provider uses PKCE.
Enable PKCE for the provider.
Generate a random string of the right length for the PKCE code verifier.
Generate the PKCE code challenge based on the PKCE code verifier in the session.
Return the hash method used to calculate the PKCE code challenge.
Details
in
HasProviderContext at line 19
mixed
getContext(string $key, mixed $default = null)
No description
in
HasProviderContext at line 24
mixed
setContext(string $key, mixed $value)
No description
in
HasProviderContext at line 29
mixed
getOrSetContext(string $key, mixed $value)
No description
in
HasProviderContext at line 34
protected string
getContextKey(string $key)
No description
at line 48
__construct(Request $request, string $clientId, string $clientSecret, string $redirectUrl, array $guzzle = [])
Create a new provider instance.
in
AbstractProvider at line 58
AbstractProvider
withConfig(array $config)
Set the baseline provider configuration.
Called once at registration time (e.g. from a builder or an extend callback). Writes to the instance property so config survives across coroutines. For per-request overrides, use setConfig() instead.
at line 409
AbstractProvider
setConfig(array $config)
Override provider configuration for the current request.
Extends the base setConfig to also handle OAuth2-specific credential keys (client_id, client_secret, redirect) in coroutine context.
in
AbstractProvider at line 83
protected mixed
getConfig(string|null $key = null, mixed $default = null)
Get a value from the provider configuration.
Reads per-request context first, falls back to baseline instance property.
in
AbstractProvider at line 93
protected Client
getHttpClient()
Get an instance of the Guzzle HTTP client.
in
AbstractProvider at line 103
AbstractProvider
setHttpClient(Client $client)
Set the Guzzle HTTP client instance.
in
AbstractProvider at line 116
AbstractProvider
setRequest(Request $request)
Set the request instance.
Stores the request in coroutine context so cached providers read the current request without leaking it to concurrent coroutines.
in
AbstractProvider at line 126
protected Request
getRequest()
Get the request instance.
in
AbstractProvider at line 135
protected bool
usesState()
Determine if the provider is operating with state.
in
AbstractProvider at line 143
protected bool
isStateless()
Determine if the provider is operating as stateless.
in
AbstractProvider at line 151
AbstractProvider
stateless()
Indicate that the provider should operate as stateless.
in
AbstractProvider at line 161
protected string
getState()
Get the string used for session state.
in
AbstractProvider at line 169
AbstractProvider
with(array $parameters)
Set the custom parameters of the request.
in
AbstractProvider at line 179
protected array
getParameters()
Get the custom parameters of the request.
at line 61
abstract protected string
getAuthUrl(string|null $state)
Get the authentication URL for the provider.
at line 66
abstract protected string
getTokenUrl()
Get the token URL for the provider.
at line 71
abstract protected mixed
getUserByToken(string $token)
Get the raw user for the given access token.
at line 76
abstract protected User
mapUserToObject(array $user)
Map the raw user array to a Socialite User instance.
at line 81
RedirectResponse
redirect()
Redirect the user of the application to the provider's authentication screen.
at line 99
protected string
buildAuthUrlFromBase(string $url, string|null $state)
Build the authentication URL for the provider from the given base URL.
at line 107
protected array
getCodeFields(string|null $state = null)
Get the GET parameters for the code request.
at line 131
protected string
formatScopes(array $scopes, string $scopeSeparator)
Format the given scopes.
at line 136
User
user()
Get the User instance for the authenticated user.
at line 156
protected User|null
getUser()
Get the user instance from the context.
at line 164
protected AbstractProvider
setUser(User $user)
Set the user instance in the context.
at line 174
protected User
userInstance(array $response, array $user)
Create a user instance from the given data.
at line 189
User
userFromToken(string $token)
Get a Social User instance from a known access token.
at line 199
protected bool
hasInvalidState()
Determine if the current request / session has a mismatching "state".
at line 213
mixed
getAccessTokenResponse(string $code)
Get the access token response for the given code.
at line 226
protected array
getTokenHeaders(string $code)
Get the headers for the access token request.
at line 234
protected array
getTokenFields(string $code)
Get the POST fields for the token request.
at line 254
Token
refreshToken(string $refreshToken)
Refresh a user's access token with a refresh token.
at line 269
protected mixed
getRefreshTokenResponse(string $refreshToken)
Get the refresh token response for the given refresh token.
at line 285
protected string
getCode()
Get the code from the request.
at line 293
AbstractProvider
scopes(array|string $scopes)
Merge the scopes of the requested access.
at line 305
AbstractProvider
setScopes(array|string $scopes)
Set the scopes of the requested access.
at line 318
array
getScopes()
Get the current scopes.
at line 328
AbstractProvider
redirectUrl(string $url)
Set the redirect URL.
at line 338
protected string
getRedirectUrl()
Get the redirect URL.
at line 346
protected string
getClientId()
Get the client ID.
at line 354
protected string
getClientSecret()
Get the client secret.
at line 362
protected bool
usesPKCE()
Determine if the provider uses PKCE.
at line 370
AbstractProvider
enablePKCE()
Enable PKCE for the provider.
at line 380
protected string
getCodeVerifier()
Generate a random string of the right length for the PKCE code verifier.
at line 388
protected string
getCodeChallenge()
Generate the PKCE code challenge based on the PKCE code verifier in the session.
at line 398
protected string
getCodeChallengeMethod()
Return the hash method used to calculate the PKCE code challenge.