APIAccess
in package
Check settings for limited access REST API or not, if yes then validate the API key.
On failed, return 403 status code with message.
Tags
Table of Contents
Properties
- $Container : Container
Methods
- __construct() : mixed
- The class constructor.
- init() : string|null
- Initialize to detect if root URL is not in exception or front pages URLs then redirect to admin.
- bindTextDomain() : mixed
- Bind text domain.
- getRequestAPIKey() : string
- Get API key from requested headers, or POST body, or GET query string.
- isSamsSite() : bool
- Check if same site request.
- response() : mixed
- Response header and body.
Properties
$Container
protected
Container
$Container
Methods
__construct()
The class constructor.
public
__construct(Container $Container) : mixed
Parameters
- $Container : Container
-
The DI container class.
init()
Initialize to detect if root URL is not in exception or front pages URLs then redirect to admin.
public
init([string|null $response = '' ]) : string|null
Parameters
- $response : string|null = ''
Return values
string|nullbindTextDomain()
Bind text domain.
protected
bindTextDomain() : mixed
getRequestAPIKey()
Get API key from requested headers, or POST body, or GET query string.
protected
getRequestAPIKey() : string
This will be trim empty space on the edge of the key.
Return values
string —Return API key from requester.
isSamsSite()
Check if same site request.
protected
isSamsSite() : bool
Return values
bool —Return true
if same site request, false
for otherwise.
response()
Response header and body.
protected
response(array<string|int, mixed> $output) : mixed
This method will be send headers and body then exit execution.
Parameters
- $output : array<string|int, mixed>
-
The array for response body.