授权服务器入门(一)
本文主要讲授权服务器基本入门,还有client_credentials和password授权方式。client_credentials是机器或应用之间交互,没有用户介入,不对外开放注册。password需要用户交互,在获取服务器资源之前需要用户名和密码认证。另外password的授权方式返回的token有refresh_token,而client_credentials没有。
1 工程代码
1.1Maven依赖
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-oauth2</artifactId>
</dependency>