Created
November 29, 2015 22:46
-
-
Save khamiltonuk/44052deb2bac1dd546c8 to your computer and use it in GitHub Desktop.
Simple CSRF Protection with Spring MVC
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @Controller | |
| @RequestMapping(PAGE_PATH) | |
| public final class DangerousPageController { | |
| @SecureToken(value = VIEW_NAME) | |
| @RequestMapping(method = RequestMethod.GET) | |
| public String showPage() { | |
| // Show the page… | |
| } | |
| @SecureToken(value = VIEW_NAME) | |
| @RequestMapping(method = RequestMethod.POST) | |
| public String submitPage() { | |
| // Process the submit | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment