AuthServerDiscovery
class AuthServerDiscovery
Traits
Properties
| protected int | $maxOAuthResponseSize | from InteractsWithOAuthEndpoints | |
| static protected Closure|null | $hostResolver |
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.
Resolve OAuth destination hostnames with the given callback instead of DNS.
Get the addresses the resolveHostsUsing() callback supplies for a hostname.
Discover and validate the resource's authorization server.
Require caller-supplied metadata to be advertised by the resource.
Validate each request hop against the OAuth destination policy and pin it to the vetted addresses.
Probe the resource for its unauthenticated authorization challenge.
Fetch optional or explicitly requested protected resource metadata.
Verify that metadata belongs to the requested resource.
Get the resource's first advertised authorization server.
Fetch authorization metadata from the issuer's supported discovery paths.
Get the OAuth and OpenID discovery URLs for an issuer.
Build a well-known metadata URL for the resource path and query.
Get the URL's origin.
Require HTTPS outside local development endpoints.
Validate a metadata endpoint before fetching it.
Prevent remote resources from directing authorization to local endpoints.
Determine whether a host is local or a non-public address literal.
Build an origin from parsed URL components.
Parse the URL components required for discovery.
Flush all static state.
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 41
static void
resolveHostsUsing(Closure|null $callback)
Resolve OAuth destination hostnames with the given callback instead of DNS.
The callback persists in a static property for the worker lifetime and supplies the addresses for every OAuth request.
at line 54
static array|null
resolvedHostAddresses(string $host)
| internal |
Get the addresses the resolveHostsUsing() callback supplies for a hostname.
at line 62
DiscoveryResult
discover(string $resourceUrl, string|null $resourceMetadataUrl = null)
Discover and validate the resource's authorization server.
at line 119
void
requireAdvertised(string $resourceUrl, string $resourceMetadataUrl, array $headers = [])
Require caller-supplied metadata to be advertised by the resource.
at line 145
PendingRequest
pin(PendingRequest $request)
Validate each request hop against the OAuth destination policy and pin it to the vetted addresses.
at line 168
protected Response
probe(string $resourceUrl, array $headers)
Probe the resource for its unauthenticated authorization challenge.
at line 199
protected array
fetchResourceMetadata(string $metadataUrl, bool $explicit = false)
Fetch optional or explicitly requested protected resource metadata.
at line 229
protected void
requireResourceMatches(array $resourceMetadata, string $resourceUrl)
Verify that metadata belongs to the requested resource.
at line 250
protected string|null
issuerFrom(array $resourceMetadata)
Get the resource's first advertised authorization server.
at line 264
protected AuthServerMetadata
fetchMetadata(string $issuer)
Fetch authorization metadata from the issuer's supported discovery paths.
at line 288
protected array
metadataUrls(string $issuer)
Get the OAuth and OpenID discovery URLs for an issuer.
at line 313
protected string
wellKnown(string $url, string $type)
Build a well-known metadata URL for the resource path and query.
at line 330
protected string
origin(string $url)
Get the URL's origin.
at line 338
protected void
requireSecure(string $url)
Require HTTPS outside local development endpoints.
at line 359
void
requireFetchable(string $url, string $resourceUrl)
Validate a metadata endpoint before fetching it.
at line 368
protected void
requireNotInternal(string $url, string $resourceUrl)
Prevent remote resources from directing authorization to local endpoints.
at line 397
protected bool
isInternalHost(string $host)
Determine whether a host is local or a non-public address literal.
at line 415
protected string
originFromParts(array $parts)
Build an origin from parsed URL components.
at line 425
protected array
parse(string $url)
Parse the URL components required for discovery.
at line 440
static void
flushState()
Flush all static state.