Ubiquity 2.5.2
php rapid development framework
Loading...
Searching...
No Matches
UCsrfHttp Class Reference

Ubiquity\security\csrf$UCsrfHttp This class is part of Ubiquity. More...

Static Public Member Functions

static isValidPost (string $name)
 Returns whether the given CSRF token is present and valid in POST values, given his name.
 
static isValidCookie (string $name)
 Returns whether the given CSRF token is present and valid in cookies, given his name.
 
static isValidMeta (string $name)
 Returns whether the given CSRF token is present and valid in header meta csrf-token, given his name.
 
static getTokenMeta (string $name)
 Adds a token in headers.
 
static getTokenField (string $name)
 Returns an input field with a generated token.
 
static addCookieToken (string $name, string $path='/', bool $secure=true, bool $httpOnly=true)
 Adds a token in cookies.
 

Private Attributes

const COOKIE_KEY = 'X-XSRF-TOKEN'
 

Detailed Description

Ubiquity\security\csrf$UCsrfHttp This class is part of Ubiquity.

Author
jc
Version
1.0.0

Definition at line 15 of file UCsrfHttp.php.

Member Function Documentation

◆ addCookieToken()

static addCookieToken ( string  $name,
string  $path = '/',
bool  $secure = true,
bool  $httpOnly = true 
)
static

Adds a token in cookies.

Parameters
string$name
string$path
bool$secure
bool$httpOnly
Returns
bool

Definition at line 93 of file UCsrfHttp.php.

◆ getTokenField()

static getTokenField ( string  $name)
static

Returns an input field with a generated token.

Parameters
string$name
Returns
string

Definition at line 79 of file UCsrfHttp.php.

◆ getTokenMeta()

static getTokenMeta ( string  $name)
static

Adds a token in headers.

Parameters
string$name

Definition at line 68 of file UCsrfHttp.php.

◆ isValidCookie()

static isValidCookie ( string  $name)
static

Returns whether the given CSRF token is present and valid in cookies, given his name.

Parameters
string$name
Returns
bool

Definition at line 39 of file UCsrfHttp.php.

◆ isValidMeta()

static isValidMeta ( string  $name)
static

Returns whether the given CSRF token is present and valid in header meta csrf-token, given his name.

Parameters
string$name
Returns
bool

Definition at line 55 of file UCsrfHttp.php.

◆ isValidPost()

static isValidPost ( string  $name)
static

Returns whether the given CSRF token is present and valid in POST values, given his name.

Parameters
string$name
Returns
boolean

Definition at line 25 of file UCsrfHttp.php.

Field Documentation

◆ COOKIE_KEY

const COOKIE_KEY = 'X-XSRF-TOKEN'
private

Definition at line 17 of file UCsrfHttp.php.


The documentation for this class was generated from the following file: