SpringSecurity权限认证(一)
导入依赖
<!--security 依赖-->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-security</artifactId>
</dependency>
设置数据库配置
spring.datasource.driver-class-name = com.mysql.cj.jdbc.Driver
spring.datasource.url= jdbc:mysql://localhost:3306/ds
spring.datasource.username = root
spring.datasource.password= root
security配置
自己编写security配置类继承WebSecurityConfigurerAdapter,配置相关信息。
重写第一个方法
//一般用于配置全局的某些通用事物,例如静态资源等
@Override
public void configure(WebSecurity web) throws Exception {
//跳过security的所有filter,直接跳过认证
//放行一些静态文件,比如js,css,登录界面,等
web.ignoring().antMatchers(