- 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";
}
}
推薦閱讀
- 計算機網絡安全技術(第6版·慕課版)
- Practical Network Scanning
- 工業物聯網安全
- 移動APT:威脅情報分析與數據防護
- 信息安全等級保護測評與整改指導手冊
- Web安全之深度學習實戰
- 網絡關鍵設備安全檢測實施指南
- CTF快速上手:PicoCTF真題解析(Web篇)
- 黑客攻防從入門到精通:黑客與反黑客工具篇(第2版)
- Hands-On Bug Hunting for Penetration Testers
- CCNA Security 210-260 Certification Guide
- 反黑風暴:黑客社會工程學攻防演練
- Learning Metasploit Exploitation and Development
- 智能制造的信息安全
- 0day安全