-
Notifications
You must be signed in to change notification settings - Fork 89
Configurations
minhaz edited this page Oct 5, 2017
·
10 revisions
Configuration for the php library is stored in a config.php file and the configurations are stored as php array, which is directly retrieved by the library. Config file resides in /libs/
directory.
Different parameters are explained below:
-
CSRFP_TOKEN
: name of the csrf token as it will appear inCOOKIE
,SESSION
,GET
orPOST
-
logDirectory
: location of the directory at which log files will be saved relative toconfig.php
file. This is required for file based logging (default), Not needed, in case you override logging function to implement your logging logic. (View Overriding logging function)
Default value:../log/
-
failedAuthAction
: Action code (integer) for action to be taken in case of failed validation. Has two different values for bothGET
andPOST
. Different action codes are specified as follows, (
Default:0
for bothGET
&POST
):
-
0
Send 403, Forbidden Header -
1
Strip the POST/GET query and forward the request! unset($_POST) -
2
Redirect to custom error page mentioned inerrorRedirectionPage
-
3
Show custom error message to user, mentioned incustomErrorMessage
-
4
Send 500, Internal Server Error header
-
errorRedirectionPage
: Absolute url of the file to which user should be redirected.
Default: null -
customErrorMessage
: Error Message to be shown to user. Only this text will be shown!
Default: null -
jsPath
: location of the js file relative toconfig.php
.
Default:../js/csrfprotector.js
-
jsUrl
: Absolute url of the js file. (See Setting up for more information) -
tokenLength
: length of csrfp token, Default10
-
disabledJavascriptMessage
: messaged to be shown if js is disabled (string) -
verifyGetFor
: regex rules for those urls for which csrfp validation should be enabled forGET
requests also. (View verifyGetFor rules for more information) -
cookieConfig
: this is an array of three propertiespath
,domain
,secure
- which lets you set respective properties when the csrf token is set in cookie usingsetcookie
method in php. Learn more at php.net.
PS: wiki still under development. Please create a Github issue for any correction.