function to authorise incoming post requests
public static function authorisePost()
config file for CSRFProtector @var int Array, length = 6 Property: #1: failedAuthAction (int) => action to be taken in case autherisation fails Property: #2: logDirectory (string) => directory in which log will be saved Property: #3: customErrorMessage (string) => custom error message to be sent in case of failed authentication Property: #4: jsFile (string) => location of the CSRFProtector js file Property: #5: tokenLength (int) => default length of hash Property: #6: disabledJavascriptMessage (string) => error message if client’s js is disabled
public static $config
expiry time for cookie @var int
public static $cookieExpiryTime
Function to create new cache version of js
public static function createNewJsCache()
function to be called in case of failed validation performs logging and take appropriate action
private static function failedValidationAction()
function to generate random hash of length as given in parameter max length = 128
public static function generateAuthToken()
Function to return current url of executing page
private static function getCurrentUrl()
function to initialise the csrfProtector work flow
public static function init( $length = null, $action = null )
flag for cross origin/same origin request @var bool
private static $isSameOrigin
Function to check if a url mataches for any urls Listed in config file
public static function isURLallowed( $url )
flag to check if output file is a valid HTML or not @var bool
private static $isValidHTML
Functio to log CSRF Attack
private static function logCSRFattack()
Function to modify url & append CSRF token
public static function modifyURL( $url, $token )
Rewrites form on the fly to add CSRF tokens to them.
public static function ob_handler( $buffer, $flags )
Function to set auth cookie
public static function refreshToken()
Varaible to store weather request type is post or get @var string
protected static $requestType
Function to perform static rewriting of forms and URLS
public static function rewriteHTML( $buffer )
function to check weather to use cached version of js file or not
public static function useCachedVersion()