PHP Class Airship\Engine\Security\CSRF

Afficher le fichier Open project: paragonie/airship Class Usage Examples

Protected Properties

Свойство Type Description
$expireOld boolean
$hmacIP Default to FALSE to be friendly to Tor/Mobile users
$recycleAfter integer
$sessionIndex string

Méthodes publiques

Méthode Description
__construct ( array $options = [] ) CSRF constructor.
check ( ) : boolean Validate a request based on $_SESSION and $_POST data
getTokenString ( string $lockTo = '' ) : string Retrieve a token array for unit testing endpoints
insertToken ( string $lockTo = '', boolean $echo = true ) : string Insert a CSRF token to a form
reconfigure ( array $options = [] ) Use this to change the configuration settings.

Méthodes protégées

Méthode Description
generateToken ( string $lockTo = '' ) : array Generate, store, and return the index and token
recycleTokens ( ) Enforce an upper limit on the number of tokens stored in session state by removing the oldest tokens first.

Method Details

__construct() public méthode

CSRF constructor.
public __construct ( array $options = [] )
$options array

check() public méthode

Validate a request based on $_SESSION and $_POST data
public check ( ) : boolean
Résultat boolean

generateToken() protected méthode

Generate, store, and return the index and token
protected generateToken ( string $lockTo = '' ) : array
$lockTo string What URI endpoint this is valid for
Résultat array [string, string]

getTokenString() public méthode

Retrieve a token array for unit testing endpoints
public getTokenString ( string $lockTo = '' ) : string
$lockTo string - Only get tokens locked to a particular form
Résultat string

insertToken() public méthode

Insert a CSRF token to a form
public insertToken ( string $lockTo = '', boolean $echo = true ) : string
$lockTo string This CSRF token is only valid for this HTTP request endpoint
$echo boolean if true, echo instead of returning
Résultat string

reconfigure() public méthode

Only use this if you know what you are doing.
public reconfigure ( array $options = [] )
$options array

recycleTokens() protected méthode

Enforce an upper limit on the number of tokens stored in session state by removing the oldest tokens first.
protected recycleTokens ( )

Property Details

$expireOld protected_oe property

protected bool $expireOld
Résultat boolean

$hmacIP protected_oe property

Default to FALSE to be friendly to Tor/Mobile users
protected $hmacIP

$recycleAfter protected_oe property

protected int $recycleAfter
Résultat integer

$sessionIndex protected_oe property

protected string $sessionIndex
Résultat string