MultiRequestProtection
extends MultiRequestProtection
in package
Class created by Core/Base/PluginDeploy
Tags
Table of Contents
- CACHE_KEY = 'MultiRequestProtection'
- MAX_TOKEN_AGE = 4
- MAX_TOKENS = 500
- RANDOM_STRING_LENGTH = 6
- $seed : string
- __construct() : mixed
- addSeed() : mixed
- newToken() : string
- Generates a random token.
- tokenExist() : bool
- Validates if a petition token exist, otherwise save it.
- validate() : bool
- getRandomStr() : string
- getTokens() : array<string|int, mixed>
- saveToken() : bool
- Saves the new token to cache.
Constants
CACHE_KEY
public
mixed
CACHE_KEY
= 'MultiRequestProtection'
MAX_TOKEN_AGE
public
mixed
MAX_TOKEN_AGE
= 4
MAX_TOKENS
public
mixed
MAX_TOKENS
= 500
RANDOM_STRING_LENGTH
public
mixed
RANDOM_STRING_LENGTH
= 6
Properties
$seed
protected
static string
$seed
Methods
__construct()
public
__construct() : mixed
Return values
mixed —addSeed()
public
addSeed(string $seed) : mixed
Parameters
- $seed : string
Return values
mixed —newToken()
Generates a random token.
public
newToken() : string
Return values
string —tokenExist()
Validates if a petition token exist, otherwise save it.
public
tokenExist(string $token) : bool
Parameters
- $token : string
Return values
bool —validate()
public
validate(string $token) : bool
Parameters
- $token : string
Return values
bool —getRandomStr()
protected
getRandomStr() : string
Return values
string —getTokens()
protected
getTokens() : array<string|int, mixed>
Return values
array<string|int, mixed> —saveToken()
Saves the new token to cache.
protected
saveToken(string $token) : bool
Parameters
- $token : string