PHP Class Phosphorum\Utils\Security

This component provides a set of functions to improve the security in Forum application. Prefixed version. $login = $this->request->getPost('login'); $password = $this->request->getPost('password'); $user = Users::findFirstByLogin($login); if ($user && $this->security->checkHash($password, $user->password)) { The password is valid }
Inheritance: extends Phalcon\Security
Datei anzeigen Open project: phalcon/forum Class Usage Examples

Public Methods

Method Description
checkPrefixedToken ( string $prefix, string $tokenKey = null, string $tokenValue = null, boolean $destroyIfValid = true ) : boolean Check if the CSRF token sent in the request is the same that the current in session.
destroyPrefixedToken ( string $prefix ) Removes the value of the CSRF token and key from session.
getPrefixedSessionToken ( string $prefix ) : mixed Returns the value of the CSRF token in session.
getPrefixedToken ( string $prefix ) : string Generates a pseudo random token value to be used as input's value in a CSRF check.
getPrefixedTokenKey ( string $prefix ) : string Generates a pseudo random token key to be used as input's name in a CSRF check.

Method Details

checkPrefixedToken() public method

Check if the CSRF token sent in the request is the same that the current in session.
public checkPrefixedToken ( string $prefix, string $tokenKey = null, string $tokenValue = null, boolean $destroyIfValid = true ) : boolean
$prefix string
$tokenKey string
$tokenValue string
$destroyIfValid boolean
return boolean

destroyPrefixedToken() public method

Removes the value of the CSRF token and key from session.
public destroyPrefixedToken ( string $prefix )
$prefix string

getPrefixedSessionToken() public method

Returns the value of the CSRF token in session.
public getPrefixedSessionToken ( string $prefix ) : mixed
$prefix string
return mixed

getPrefixedToken() public method

Generates a pseudo random token value to be used as input's value in a CSRF check.
public getPrefixedToken ( string $prefix ) : string
$prefix string
return string mixed

getPrefixedTokenKey() public method

Generates a pseudo random token key to be used as input's name in a CSRF check.
public getPrefixedTokenKey ( string $prefix ) : string
$prefix string
return string