摘要: 认证授权注解 1.@Secured 用户具有某个角色,可以访问方法。 (1)先在启动类中开启注解@EnableGlobalMethodSecurity(securedEnabled=true) (2)在方法上编写注解@Secured({"ROLE_sale","ROLE_manager"}) (3) 阅读全文
posted @ 2022-05-16 10:52 不想当将军的好士兵 阅读(25) 评论(0) 推荐(0)
摘要: 自定义设置登录页面,不需要认证可以访问 1.在配置类实现相关的配置 @Override protected void configure(HttpSecurity http) throws Exception { http.formLogin() //自定义自己编写的登录页面 .loginPage( 阅读全文
posted @ 2022-05-13 16:46 不想当将军的好士兵 阅读(37) 评论(0) 推荐(0)
摘要: Web权限 1.认证 (1)设置账号和密码 一.通过配置文件 application.properties spring.security.user.name=atguigu spring.security.user.password=atguigu 二.通过配置类 SecurityConfig @ 阅读全文
posted @ 2022-05-12 18:49 不想当将军的好士兵 阅读(25) 评论(0) 推荐(0)
摘要: 1.添加依赖 <!--SpringSeurity启动器--> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-security</artifactId> </depend 阅读全文
posted @ 2022-05-11 15:14 不想当将军的好士兵 阅读(29) 评论(0) 推荐(0)