Trait Csrf
Trait for class MvcCore\Ext\Form
containing methods to create, get and
verify CSRF tokens and to process CSRF error handlers if tokens are not valid.
Methods summary
public static
|
#
ProcessCsrfErrorHandlersQueue( MvcCore\Ext\IForm $form, string $errorMsg )
Call all CSRF (Cross Site Request Forgery) error handlers in static queue.
Call all CSRF (Cross Site Request Forgery) error handlers in static queue.
Parameters
- $form
- The form instance where CSRF error happened.
- $errorMsg
- Translated error message about CSRF invalid tokens.
|
public
MvcCore\Ext\Form
|
#
SetEnableCsrf( boolean $enabled = TRUE )
Enable or disable CSRF checking, enabled by default.
Enable or disable CSRF checking, enabled by default.
Parameters
Returns
|
public
stdClass
|
#
GetCsrf( )
Return current CSRF (Cross Site Request Forgery) hidden
input name and it's value as \stdClass with keys name and value .
Return current CSRF (Cross Site Request Forgery) hidden
input name and it's value as \stdClass with keys name and value .
Returns
stdClass
|
public
MvcCore\Ext\Form
|
#
SubmitCsrfTokens( array & $rawRequestParams = [] )
Check CSRF (Cross Site Request Forgery) sent tokens from user with session tokens.
If tokens are different, add form error and process CSRF error handlers queue.
If there is any exception caught in CSRF error handlers queue, it's logged
by configured core debug class with CRITICAL flag.
Check CSRF (Cross Site Request Forgery) sent tokens from user with session tokens.
If tokens are different, add form error and process CSRF error handlers queue.
If there is any exception caught in CSRF error handlers queue, it's logged
by configured core debug class with CRITICAL flag.
Parameters
- $rawRequestParams
- Raw request params given into
Submit() method or all \MvcCore\Request params.
Returns
|
public
string[]
|
#
SetUpCsrf( )
Create new fresh CSRF (Cross Site Request Forgery) tokens,
store them in current form session namespace and return them.
Create new fresh CSRF (Cross Site Request Forgery) tokens,
store them in current form session namespace and return them.
Returns
string[]
|