forked from JoyChou93/java-sec-code
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCSRF.java
More file actions
29 lines (25 loc) · 728 Bytes
/
CSRF.java
File metadata and controls
29 lines (25 loc) · 728 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
package org.joychou.controller;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
/**
* check csrf using spring-security
* Access http://localhost:8080/csrf/ -> click submit
*
* @author JoyChou ([email protected]) @2019-05-31
*/
@Controller
@RequestMapping("/csrf")
public class CSRF {
@GetMapping("/")
public String index() {
return "form";
}
@PostMapping("/post")
@ResponseBody
public String post() {
return "CSRF passed.";
}
}