You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -86,4 +86,31 @@ The content for login (freemarker engine) can be:
86
86
In above code I want to protect all pages (contacts, contact) for the Contact domain entity.
87
87
The authentication tests to see if the 'username' attribute is present in the session object. If 'username' is present
88
88
than call the regular route with `routeContext.next()` else redirect to the login page.
89
-
I added `originalDestination` attribute because after authentication process I want to continue with the original destination (original url).
89
+
I added `originalDestination` attribute because after authentication process I want to continue with the original destination (original url).
90
+
91
+
### Cross-Site Request Forgery (CSRF) Protection
92
+
93
+
Pippo includes a simple CSRF handler which will automatically generate a CSRF token on GET requests, if there is no token in the current session, and verify that POST requests include the session's CSRF token.
94
+
95
+
Using this handler is straight-forward.
96
+
97
+
**1.** Add an `ALL` filter for the protected path expression with the `CSRFHandler`.
98
+
99
+
```java
100
+
// add a CSRF token generator and validator
101
+
ALL("/books.*", newCSRFHandler());
102
+
```
103
+
104
+
**2.** Add a `${csrfToken}` hidden input value on all forms that are POSTed to this protected path expression
0 commit comments