栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 软件开发 > Web开发 > Html/CSS > Bootstrap教程

使用Spring Security安全控制

使用Spring Security安全控制

准备工作

首先,构建一个简单的Web工程,以用于后续添加安全控制,也可以用之前Chapter3-1-2做为基础工程。若对如何使用Spring Boot构建Web应用,可以先阅读《Spring Boot开发Web应用》一文。

Web层实现请求映射
@Controller
public class HelloController {
 
    @RequestMapping("/")
    public String index() {
        return "index";
    }
 
    @RequestMapping("/hello")
    public String hello() {
        return "hello";
    }
 
}
  • /:映射到index.html

  • /hello:映射到hello.html

实现映射的页面
src/main/resources/templates/index.html


    
        Spring Security入门
    
    
        欢迎使用Spring Security!
        

点击 这里 打个招呼吧

    

src/main/resources/templates/hello.html



    
        Hello World!
    
    
        Hello world!
    

可以看到在index.html中提供到/hello的链接,显然在这里没有任何安全控制,所以点击链接后就可以直接跳转到hello.html页面。

转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/243672.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号