class OAuthDestinationPolicy extends PublicDestinationPolicy

Constants

protected DISALLOWED_NETWORKS

LOCALHOSTS

Methods

__construct(array $allowedNetworks = [])

Create a new public destination policy instance.

resolve(string $url, float $timeoutSeconds)

Resolve and authorize one outbound destination within the given time budget.

void
validate(string $url)

Validate a destination URL without resolving it, such as before storing one a user entered.

string|null
proxyFor(UriInterface $uri)

Return an approved proxy for the destination.

bool
allowsAddress(UriInterface $uri, string $address)

Allow local OAuth development without trusting arbitrary private DNS targets.

array
resolveHost(string $host, float $timeoutSeconds)

Resolve hostnames through AuthServerDiscovery::resolveHostsUsing() when a callback is set.

array|false
resolveAddressFamily(string $host, int $family, float $timeoutSeconds)

Resolve one address family within its share of the request budget.

Details

__construct(array $allowedNetworks = [])

Create a new public destination policy instance.

Parameters

array $allowedNetworks

addresses or CIDR ranges that are allowed even when they are not public

ResolvedDestination resolve(string $url, float $timeoutSeconds)

Resolve and authorize one outbound destination within the given time budget.

Parameters

string $url
float $timeoutSeconds

Return Value

ResolvedDestination

Exceptions

DisallowedDestinationException
DestinationResolutionException
ProxyConnectionException

void validate(string $url)

Validate a destination URL without resolving it, such as before storing one a user entered.

A host given as an address literal is authorized now. A hostname is not resolved, so its addresses are checked when a request resolves them.

Parameters

string $url

Return Value

void

Exceptions

DisallowedDestinationException

protected string|null proxyFor(UriInterface $uri)

Return an approved proxy for the destination.

Applications that require trusted egress proxies may extend this policy and select an absolute URL from a bounded operator-configured set. The policy then vets and pins only the proxy: hostname targets are resolved by the proxy, so it must enforce the same destination rules itself.

Parameters

UriInterface $uri

Return Value

string|null

at line 18
protected bool allowsAddress(UriInterface $uri, string $address)

Allow local OAuth development without trusting arbitrary private DNS targets.

Parameters

UriInterface $uri
string $address

Return Value

bool

at line 29
protected array resolveHost(string $host, float $timeoutSeconds)

Resolve hostnames through AuthServerDiscovery::resolveHostsUsing() when a callback is set.

Parameters

string $host
float $timeoutSeconds

Return Value

array

protected array|false resolveAddressFamily(string $host, int $family, float $timeoutSeconds)

Resolve one address family within its share of the request budget.

Parameters

string $host
int $family
float $timeoutSeconds

Return Value

array|false