目录
Spring Security是一款基于Spring的安全框架,主要包含认证和授权两大安全模块和另外一款流行的安全框架Apache Shiro相比,拥有更为强大的功能。Spring Security可以轻松的自定义扩展以满足各种需求并且对常见的Web安全攻击提供了防护支持。
创建Spring Boot项目,引入spring-boot-starter-security,Spring Boot-2.5.3,Spring Security-5.5.1。
Spring Security默认用户认证
dependencies {
implementation 'org.springframework.boot:spring-boot-starter-security'
implementation 'org.springframework.boot:spring-boot-starter-web'
implementation 'org.projectlombok:lombok:1.18.8'
annotationProcessor 'org.projectlombok:lombok:1.18.8'
providedRuntime 'org.springframework.boot:spring-boot-starter-tomcat'
testImplementation 'org.springframework.boot:spring-boot-starter-test'
testImpleme