springboot-sample
介绍
springboot简单示例 跳转到发行版 查看发行版说明
软件架构(当前发行版使用)
- springboot
- hutool-all 非常好的常用java工具库 官网 maven
- bcprov-jdk18on 一些加密算法的实现 官网 maven
安装教程
git clone --branch 3.基本登录验证 git@gitee.com:simen_net/springboot-sample.git
发行版说明
- 完成基本WEB服务 跳转到发行版
- 完成了KEY初始化功能和全局错误处理 跳转到发行版
- 完成了基本登录验证 跳转到发行版 查看发行版说明
基本登录验证
增加登录验证功能
- 在pom.xml中加入
spring-boot-starter
- 增加验证配置类WebSecurityConfig.java,配置用户密码、登录接口等
- SystemController.java中增加
@GetMapping("/login")返回到登录界面模板文件login.ftl
- SystemController.java中定义的
@RequestMapping("/getPerson")增加了@PreAuthorize("hasAuthority('file_write')")权限限制
功能演示
- http://localhost:8080/index.html 无需验证
- 访问其他页面,自动跳转到 http://localhost:8080/login.html ,按照页面上提示,分别使用simen和admin用户登录测试访问权限