Spring Security 实战 - Spring Secu
2018-11-22 本文已影响87人
紫霞等了至尊宝五百年
OAuth 是一个开放标准,允许用户让第三方应用访问该用户在某一网站上存储的私密的资源,而不需要将用户名和密码提供给第三方应用
OAuth允许用户提供一个令牌,而不是用户名和密码来访问他们存放在特定服务提供者的数据
每一个令牌授权一个特定的网站在特定的时段内访问特定的资源。这样,OAuth让用户可以授权第三方网站访问他们存储在另外服务提供者的某些特定信息
项目准备
- 添加依赖
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-security</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.security.oauth</groupId>
<artifactId>spring-security-oauth2</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
</dependency>