- Hands-On Spring Security 5 for Reactive Applications
- Tomcy John
- 84字
- 2021-07-23 18:59:22
Step 8—Controller setup
Let's create a base controller (HomeController) for the secured JSP page (home.jsp). Please note that the return of the mapping method should be a string, and it should map to the actual name of the JSP file. In our case, it is home.jsp, a secured resource that the caller navigates when they log in:
@Controller
public class HomeController {
@GetMapping("/")
public String home(Model model, Principal principal) {
if(principal != null)
model.addAttribute("msg", "Welcome " + principal.getName());
return "home";
}
}
推薦閱讀
- 腦洞大開:滲透測試另類實戰攻略
- 特種木馬防御與檢測技術研究
- .NET安全攻防指南(上冊)
- 防火墻技術與應用(第2版)
- Kali Linux Network Scanning Cookbook(Second Edition)
- Applied Network Security
- 數據安全與隱私計算(第3版)
- 網絡安全能力成熟度模型:原理與實踐
- 學電腦安全與病毒防范
- Web安全之深度學習實戰
- Learning Pentesting for Android Devices
- 實用黑客攻防技術
- 數字政府網絡安全合規性建設指南:密碼應用與數據安全
- INSTANT Microsoft Forefront UAG Mobile Configuration Starter
- 中國網絡空間安全前沿科技發展報告(2018)