PHP Class Neos\Flow\Http\Component\TrustedProxiesComponent

Inheritance: implements Neos\Flow\Http\Component\ComponentInterface
Show file Open project: neos/flow-development-collection Class Usage Examples

Protected Properties

Property Type Description
$settings array

Public Methods

Method Description
handle ( ComponentContext $componentContext ) : void

Protected Methods

Method Description
getFirstTrustedProxyHeaderValue ( string $type, Request $request ) : mixed | null Convenience getter for the first value of a given trusted proxy header.
getTrustedClientIpAddress ( Request $request ) : string | boolean Get the most trusted client's IP address.
getTrustedProxyHeaderValues ( string $type, Request $request ) : Iterator Get the values of trusted proxy header.
ipIsTrustedProxy ( string $ipAddress ) : boolean Check if the given IP address is from a trusted proxy.
isFromTrustedProxy ( Request $request ) : boolean Check if the given request is from a trusted proxy.

Method Details

getFirstTrustedProxyHeaderValue() protected method

Convenience getter for the first value of a given trusted proxy header.
protected getFirstTrustedProxyHeaderValue ( string $type, Request $request ) : mixed | null
$type string One of the HEADER_* constants
$request Neos\Flow\Http\Request The request to get the trusted proxy header from
return mixed | null The first value of this header type or NULL if this header type should not be trusted

getTrustedClientIpAddress() protected method

This is the right-most address in the trusted client IP header, that is not a trusted proxy address. If all proxies are trusted, this is the left-most address in the header. If no proxies are trusted or no client IP header is trusted, this is the remote address of the machine directly connected to the server.
protected getTrustedClientIpAddress ( Request $request ) : string | boolean
$request Neos\Flow\Http\Request
return string | boolean The most trusted client's IP address or FALSE if no remote address can be found

getTrustedProxyHeaderValues() protected method

Get the values of trusted proxy header.
protected getTrustedProxyHeaderValues ( string $type, Request $request ) : Iterator
$type string One of the HEADER_* constants
$request Neos\Flow\Http\Request The request to get the trusted proxy header from
return Iterator An array of the values for this header type or NULL if this header type should not be trusted

handle() public method

public handle ( ComponentContext $componentContext ) : void
$componentContext ComponentContext
return void

ipIsTrustedProxy() protected method

Check if the given IP address is from a trusted proxy.
protected ipIsTrustedProxy ( string $ipAddress ) : boolean
$ipAddress string
return boolean

isFromTrustedProxy() protected method

Check if the given request is from a trusted proxy.
protected isFromTrustedProxy ( Request $request ) : boolean
$request Neos\Flow\Http\Request
return boolean If the server REMOTE_ADDR is from a trusted proxy

Property Details

$settings protected property

protected array $settings
return array