Download the PHP package ob-ivan/sd-csrf without Composer
On this page you can find all versions of the php package ob-ivan/sd-csrf. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Please rate this library. Is it a good library?
Informations about the package sd-csrf
A simple unique token utility to prevent cross-site resource forging (CSRF) attacks.
Installation
Usage
The general use case may be outlined as follows:
- A controller requests a token, which csrf manager generates and stores in session data under some reconstructable key.
- A view prints token value to a hidden input.
- User submits a form, which brings token value to form processing controller.
- That second controller reconstructs the key and asks manager to verify the token value, and rejects the form if the value differs.
This reduces chances that the said form would be sent without user's consent.
Please note that a manager instance may be either provided with dependency injection container, or instantiated at call time as it is currently stateless (which is not guaranteed to hold in future, though).
A sample code would be as follows:
The corresponding view code:
All versions of sd-csrf with dependencies
PHP Build Version
Package Version
Requires
ob-ivan/sd-dependency-injection Version
^1.2.2
symfony/http-foundation Version ^3.3 || ^4.0
symfony/http-foundation Version ^3.3 || ^4.0
The package ob-ivan/sd-csrf contains the following files
Loading the files please wait ....