https://github.com/dederobert/duskphp-middleware
A middleware's collection
https://github.com/dederobert/duskphp-middleware
csrf-prevention csrf-protection csrf-tokens http-middleware middleware psr-15 psr-7
Last synced: about 2 months ago
JSON representation
A middleware's collection
- Host: GitHub
- URL: https://github.com/dederobert/duskphp-middleware
- Owner: dederobert
- License: gpl-3.0
- Created: 2017-08-26T13:33:06.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2017-08-27T14:17:04.000Z (over 8 years ago)
- Last Synced: 2025-06-11T10:19:45.092Z (9 months ago)
- Topics: csrf-prevention, csrf-protection, csrf-tokens, http-middleware, middleware, psr-15, psr-7
- Language: PHP
- Size: 23.4 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# DuskPHP - Middleware
[](https://travis-ci.org/Hovensoft/duskphp-middleware)
[](https://coveralls.io/github/Hovensoft/duskphp-middleware?branch=master)
Provide middleware:
- a CSRF authenticator which protect against CSRF attack with a token authentication
## How to use
- ## CSRF Authenticator
__How to use it ?__
This middleware check every POST, PUT and DELETE request for a CSRF token.
```php
$middleware = new CsrfMiddleware($_SESSION, 200);
$dispatcher->pipe($middleware);
```
__Input__
The middleware check if the string `<:csrf_token_field:>` is in response and replace it with
the authenticator's token.
```html
...
<:csrf_token_field:>
```
## LICENSE
DuskPHP - A simple PHP framework build with middleware pattern
Copyright (C) 2017 HovenSoft
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
any later version
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see [www.gnu.org/licenses](http://www.gnu.org/licenses).