文章分类 -  SpringSecurity

摘要:Security方法安全 配置类中开启 添加注解 @EnableGlobalMethodSecurity(prePostEnabled = true, securedEnabled = true) 编写方法 /** * @title: MethodService * @projectName spr 阅读全文
posted @ 2020-05-19 22:11 Leader_TBlog 阅读(132) 评论(0) 推荐(0)
摘要:Security密码加密 密码加密 在单元测试中 使用循环生成 10次不同的 密文,在Security中 有一个 BCryptPasswordEncoder 密码加密的工具 @Test void contextLoads() { BCryptPasswordEncoder encoder = new 阅读全文
posted @ 2020-05-19 21:54 Leader_TBlog 阅读(871) 评论(0) 推荐(0)
摘要:创建一个配置类 /** * @title: MultiSecurityConfig * @projectName springsecurity * @描述: TODO * @作者: 小灰灰 * @创建时间 2020-05-1920:16 */ @Configuration public class 阅读全文
posted @ 2020-05-19 21:18 Leader_TBlog 阅读(220) 评论(0) 推荐(0)
摘要:重写 HttpSecurity @Override protected void configure(HttpSecurity http) throws Exception { // 开启配置 http.authorizeRequests() // 访问路径以: /admin/开头的 需要具备哪些角 阅读全文
posted @ 2020-05-19 21:17 Leader_TBlog 阅读(198) 评论(0) 推荐(0)
摘要:重写 HttpSecurity configure @Override protected void configure(HttpSecurity http) throws Exception { // 开启配置 http.authorizeRequests() // 访问路径以: /admin/开 阅读全文
posted @ 2020-05-16 20:18 Leader_TBlog 阅读(138) 评论(0) 推荐(1)
摘要:重写 HttpSecurity configure @Override protected void configure(HttpSecurity http) throws Exception { // 开启配置 http.authorizeRequests() // 访问路径以: /admin/开 阅读全文
posted @ 2020-05-14 00:47 Leader_TBlog 阅读(717) 评论(0) 推荐(0)
摘要:通过配置文件配置 spring.security.user.name=javaboy spring.security.user.password=1234 # 角色: 支持数组 spring.security.user.roles=admin 配置完毕,再次启动项目,访问 /hello 一样的输入用 阅读全文
posted @ 2020-05-13 22:50 Leader_TBlog 阅读(210) 评论(0) 推荐(0)
摘要:创建工程 选择依赖 这里只需要引入上面两个依赖即可, next 重点: 只要加入了 Security 的依赖,项目中的所有接口统统被保护起来了! @RestController public class HelloController { @GetMapping("/hello") public S 阅读全文
posted @ 2020-05-13 22:15 Leader_TBlog 阅读(123) 评论(0) 推荐(0)