parent
9718ead9c3
commit
e942e39fdf
@ -1,37 +0,0 @@
|
|||||||
package kr.re.etri.autoflow.controllers;
|
|
||||||
|
|
||||||
import org.springframework.security.access.prepost.PreAuthorize;
|
|
||||||
import org.springframework.web.bind.annotation.CrossOrigin;
|
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
|
||||||
|
|
||||||
//for Angular Client (withCredentials)
|
|
||||||
//@CrossOrigin(origins = "http://localhost:8081", maxAge = 3600, allowCredentials="true")
|
|
||||||
@CrossOrigin(origins = "*", maxAge = 3600)
|
|
||||||
@RestController
|
|
||||||
@RequestMapping("/api/test")
|
|
||||||
public class TestController {
|
|
||||||
@GetMapping("/all")
|
|
||||||
public String allAccess() {
|
|
||||||
return "Public Content.";
|
|
||||||
}
|
|
||||||
|
|
||||||
@GetMapping("/user")
|
|
||||||
@PreAuthorize("hasRole('USER') or hasRole('MODERATOR') or hasRole('ADMIN')")
|
|
||||||
public String userAccess() {
|
|
||||||
return "User Content.";
|
|
||||||
}
|
|
||||||
|
|
||||||
@GetMapping("/mod")
|
|
||||||
@PreAuthorize("hasRole('MODERATOR')")
|
|
||||||
public String moderatorAccess() {
|
|
||||||
return "Moderator Board.";
|
|
||||||
}
|
|
||||||
|
|
||||||
@GetMapping("/admin")
|
|
||||||
@PreAuthorize("hasRole('ADMIN')")
|
|
||||||
public String adminAccess() {
|
|
||||||
return "Admin Board.";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Loading…
Reference in new issue