CsrfMiddleware class
Stops cross site request forgery (CSRF).
A POST, PUT, PATCH or DELETE request must send the CSRF token of the
session, in the _token body field or the X-CSRF-TOKEN or
X-XSRF-TOKEN header. Else Dox answers 419.
It also sets the XSRF-TOKEN cookie. Page scripts can read it.
axios and Inertia send it back in X-XSRF-TOKEN for you.
Put it after SessionMiddleware.
CsrfMiddleware(except: <String>['/api/*', '/webhooks/stripe']);
- Implemented types
Constructors
-
CsrfMiddleware({List<
String> except = const <String>[]}) -
const
Properties
Methods
-
handle(
DoxRequest req, Next next) → Future< DoxResponse> -
override
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Constants
- the name of the cookie that page scripts read