PHP Class Imbo\EventListener\StatsAccess

This event listener lets you control the access to the /stats endpoint by white-/blacklisting ip addresses or subnets (using CIDR notation). If you disable the listener from the configuration it will be open to anyone (and it does not require an access token by default).
Author: Christer Edvartsen ([email protected])
Inheritance: implements Imbo\EventListener\ListenerInterface
Datei anzeigen Open project: imbo/imbo Class Usage Examples

Public Methods

Method Description
__construct ( array $params = [] ) Class constructor
checkAccess ( Imbo\EventManager\EventInterface $event )
getSubscribedEvents ( )

Private Methods

Method Description
cidr4Match ( string $ip, string $range ) : boolean Check an IPv4 address is in a subnet
cidr6Match ( string $ip, string $range ) : boolean Check an IPv6 address is in a subnet
cidrMatch ( string $ip, string $range ) : boolean Check if an IP address is in a subnet
expandIPv6 ( string $ip ) : string Expand a short IPv6
expandIPv6InFilters ( string &$ip ) Expand all IPv6 addresses in a filter
getBinaryMask ( integer $mask ) : string Fetch the binary representation of a mask
isAllowed ( string $ip ) : boolean See if an IP address is allowed
isIPv4 ( string $ip ) : boolean Check if an IP address ia an IPv4 address or not
isIPv6 ( string $ip ) : boolean Check if an IP address is an IPv6 address or not

Method Details

__construct() public method

Class constructor
public __construct ( array $params = [] )
$params array Parameters for the listener

checkAccess() public method

public checkAccess ( Imbo\EventManager\EventInterface $event )
$event Imbo\EventManager\EventInterface

getSubscribedEvents() public static method

public static getSubscribedEvents ( )