WhitelistSubscriber
in package
implements
EventSubscriberInterface
The WhitelistSubscriber listens to API requests and matches them against a whitelist of allowed API calls. If an API call does NOT appear in the whitelist, then it generates an error.
Tags
Table of Contents
Interfaces
- EventSubscriberInterface
Properties
- $activeRules : array<string|int, mixed>
- Array (scalar $reqId => WhitelistRule $rule).
- $rules : array<string|int, mixed>
- Array(WhitelistRule).
Methods
- __construct() : mixed
- getSubscribedEvents() : array<string|int, mixed>
- onApiAuthorize() : mixed
- Determine which, if any, whitelist rules apply this request.
- onApiRespond() : mixed
- Apply any filtering rules based on the chosen whitelist rule.
Properties
$activeRules
Array (scalar $reqId => WhitelistRule $rule).
protected
array<string|int, mixed>
$activeRules
$rules
Array(WhitelistRule).
protected
array<string|int, mixed>
$rules
Methods
__construct()
public
__construct(array<string|int, mixed> $rules) : mixed
Parameters
- $rules : array<string|int, mixed>
-
Array of WhitelistRule.
Tags
getSubscribedEvents()
public
static getSubscribedEvents() : array<string|int, mixed>
Return values
array<string|int, mixed>onApiAuthorize()
Determine which, if any, whitelist rules apply this request.
public
onApiAuthorize(AuthorizeEvent $event) : mixed
Reject unauthorized requests.
Parameters
- $event : AuthorizeEvent
Tags
onApiRespond()
Apply any filtering rules based on the chosen whitelist rule.
public
onApiRespond(RespondEvent $event) : mixed
Parameters
- $event : RespondEvent