OAuthClient
class OAuthClient
Traits
Properties
| protected int | $maxOAuthResponseSize | from InteractsWithOAuthEndpoints | |
| protected DiscoveryResult|null | $discovered | ||
| protected string|null | $returnTo |
Methods
Prepare a buffered OAuth request without following redirects.
Validate and pin an OAuth endpoint within the prepared request's limits.
Determine whether the normalized host names a local development endpoint.
Normalize the host consistently with destination validation.
Create an OAuth client for the configured resource.
Redirect to the authorization server and remember the pending exchange.
Obtain a token using the configured client credentials.
Exchange the current authorization callback for a token.
Get the return URL remembered by the authorization exchange.
Refresh an access token using its client credentials.
Validate and exchange the authorization code against the pending session.
Determine whether the client can identify itself through a metadata document.
Determine whether a metadata document host is eligible for public discovery.
Register a client when no configured client identifier is available.
Request a token using the selected client authentication method.
Report an authorization error returned in the callback.
Get a nonempty string from the callback query.
Discover the authorization server once for this client.
Resolve the challenged or configured authorization scope.
Use advertised scopes when no authorization scope was selected.
Choose a supported authentication method for the available credentials.
Identify loopback callback applications as native clients.
Validate the callback issuer against the pending authorization.
Get the session key for this client's pending authorization.
Details
in
InteractsWithOAuthEndpoints at line 26
protected PendingRequest
oAuthRequest()
Prepare a buffered OAuth request without following redirects.
in
InteractsWithOAuthEndpoints at line 51
protected ResolvedDestination
resolveOAuthDestination(PendingRequest $request, string $url)
Validate and pin an OAuth endpoint within the prepared request's limits.
in
InteractsWithOAuthEndpoints at line 63
protected bool
isLocalhost(string $host)
Determine whether the normalized host names a local development endpoint.
in
InteractsWithOAuthEndpoints at line 71
protected string
normalizedHost(string $host)
Normalize the host consistently with destination validation.
at line 30
__construct(OAuthConfig $config, string $resourceUrl, string|null $resourceMetadataUrl = null, string|null $challengeScope = null, AuthServerDiscovery $discovery = new AuthServerDiscovery(), string|null $clientIdMetadataUrl = null, array $resourceHeaders = [])
Create an OAuth client for the configured resource.
at line 45
RedirectResponse
redirect(string|null $returnTo = null)
Redirect to the authorization server and remember the pending exchange.
at line 112
TokenSet
clientCredentials()
Obtain a token using the configured client credentials.
at line 136
TokenSet
exchangeCallback()
Exchange the current authorization callback for a token.
at line 159
string|null
returnTo()
Get the return URL remembered by the authorization exchange.
at line 167
TokenSet
refreshCredentials(string $refreshToken, string|null $clientId = null, string|null $clientSecret = null)
Refresh an access token using its client credentials.
at line 202
protected TokenSet
exchangeAuthorizationCode(string $code, string $state, string|null $iss)
Validate and exchange the authorization code against the pending session.
at line 270
protected bool
usesClientIdMetadataDocument(AuthServerMetadata $metadata)
Determine whether the client can identify itself through a metadata document.
at line 293
protected bool
isPubliclyResolvable(string $host)
Determine whether a metadata document host is eligible for public discovery.
at line 311
protected ClientRegistration
register(AuthServerMetadata $metadata, string $redirectUri)
Register a client when no configured client identifier is available.
at line 331
protected TokenSet
requestToken(string $tokenEndpoint, array $params, string|null $clientId, string|null $clientSecret, TokenEndpointAuthMethod $authMethod)
Request a token using the selected client authentication method.
at line 374
protected void
throwOnServerError()
Report an authorization error returned in the callback.
at line 399
protected string|null
query(string $key)
Get a nonempty string from the callback query.
at line 409
protected DiscoveryResult
discover()
Discover the authorization server once for this client.
at line 417
protected string|null
resolveScope()
Resolve the challenged or configured authorization scope.
at line 429
protected string|null
authorizationScope()
Use advertised scopes when no authorization scope was selected.
at line 444
protected TokenEndpointAuthMethod
resolveTokenAuthMethod(AuthServerMetadata $metadata, string|null $clientSecret)
Choose a supported authentication method for the available credentials.
at line 467
protected string
applicationType(string $redirectUri)
Identify loopback callback applications as native clients.
at line 481
protected void
validateIssuer(array $stored, string|null $iss)
Validate the callback issuer against the pending authorization.
at line 501
protected string
sessionKey()
Get the session key for this client's pending authorization.