Spring Security 변경

This commit is contained in:
현성필
2024-04-25 10:48:33 +09:00
parent 7d97628d38
commit 01e6b34cdd
8 changed files with 92 additions and 77 deletions
@@ -8,6 +8,7 @@ import com.eactive.testmaster.server.service.ServerMgmtService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.security.access.annotation.Secured;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.validation.BindingResult;
@@ -40,6 +41,7 @@ public class ServerMgmtController {
public static final String SERVER_LIST_VIEW = "redirect:/mgmt/servers/list_view.do";
@GetMapping("/list_view.do")
@Secured("ROLE_MANAGE_SERVER")
public String listView(@ModelAttribute("serverSearch") ServerSearch serverSearch,
ModelMap model,
Pageable pageable) {
@@ -53,6 +55,7 @@ public class ServerMgmtController {
}
@GetMapping("/create_view.do")
@Secured("ROLE_MANAGE_SERVER")
public String createView(ModelMap model) {
ServerDTO defaultServer = new ServerDTO();
model.addAttribute(SERVER, defaultServer);
@@ -60,6 +63,7 @@ public class ServerMgmtController {
}
@GetMapping("/update_view.do")
@Secured("ROLE_MANAGE_SERVER")
public String updateView(ModelMap model, @RequestParam("id") Long id) {
Server found = serverMgmtService.findById(id);
ServerDTO server = serverMapper.map(found);
@@ -68,6 +72,7 @@ public class ServerMgmtController {
}
@PostMapping("/register.do")
@Secured("ROLE_MANAGE_SERVER")
public String register(@ModelAttribute(SERVER) ServerDTO dto,
BindingResult bindingResult,
ModelMap model) {
@@ -89,6 +94,7 @@ public class ServerMgmtController {
}
@PostMapping("/update.do")
@Secured("ROLE_MANAGE_SERVER")
public String update(@ModelAttribute(SERVER) ServerDTO dto,
BindingResult bindingResult,
ModelMap model) {
@@ -110,6 +116,7 @@ public class ServerMgmtController {
}
@PostMapping("/delete.do")
@Secured("ROLE_MANAGE_SERVER")
public String delete(@RequestParam("checkedIdForDel") List<String> checkedIdForDel) {
for (String id : checkedIdForDel) {
serverMgmtService.delete(Long.parseLong(id));