Zend Framework
LICENSE
This source file is subject to the new BSD license that is bundled with this package in the file LICENSE.txt. It is also available through the world-wide-web at this URL: http://framework.zend.com/license/new-bsd If you did not receive a copy of the license and are unable to obtain it through the world-wide-web, please send an email to license@zend.com so we can send you a copy immediately.
CSRF form protection

__construct(
string|array|\Zend_Config $spec, array|\Zend_Config $options
=
null
)
:
void
Constructor
Creates session namespace for CSRF token, and adds validator for CSRF token.
Name | Type | Description |
---|---|---|
$spec | string|array|\Zend_Config | |
$options | array|\Zend_Config |

_generateHash(
)
:
void
Generate CSRF token
Generates CSRF token and stores both in {@link $_hash} and element value.

getHash(
)
:
string
Retrieve CSRF token
If no CSRF token currently exists, generates one.
Type | Description |
---|---|
string |

getSession(
)
:
\Zend_Session_Namespace
Get session object
Instantiate session object if none currently exists
Type | Description |
---|---|
\Zend_Session_Namespace |

getSessionName(
)
:
string
Get session namespace for CSRF token
Generates a session namespace based on salt, element name, and class.
Type | Description |
---|---|
string |

initCsrfValidator(
)
:
\Zend_Form_Element_Hash
Initialize CSRF validator
Creates Session namespace, and initializes CSRF token in session. Additionally, adds validator for validating CSRF token.
Type | Description |
---|---|
\Zend_Form_Element_Hash |

setSession(
\Zend_Session_Namespace $session
)
:
\Zend_Form_Element_Hash
Set session object
Name | Type | Description |
---|---|---|
$session | \Zend_Session_Namespace |
Type | Description |
---|---|
\Zend_Form_Element_Hash |