前言
在使用SpringSecurity的时候,初学者很容易被认证和鉴权两个概念搞混,本人一开始也容易犯糊涂,在这个上面纠缠了很久,简单理就是,认证理解成登录即可,鉴权的范围稍微大点,可以理解为访问服务端资源的权限,比如菜单权限,数据权限等
今天要说的是SpringSecurity的认证常用的几种方式
环境准备
为演示方便,我们快速搭建一个demo工程,引入基本依赖:
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-security</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
<