Skip to content

Instantly share code, notes, and snippets.

@khamiltonuk
Created November 29, 2015 22:46
Show Gist options
  • Select an option

  • Save khamiltonuk/44052deb2bac1dd546c8 to your computer and use it in GitHub Desktop.

Select an option

Save khamiltonuk/44052deb2bac1dd546c8 to your computer and use it in GitHub Desktop.
Simple CSRF Protection with Spring MVC
@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