开源项目:https://gitee.com/owenwangwen/open-capacity-platform/tree/master/oauth-center/auth-server
认证中心 auth-server
auth-server在项目中的位置
![03.认证中心auth-server](https://img-blog.csdnimg.cn/img_convert/90d5dd468abe56a3674f8b7898ff3d4c.png)
auth-server在项目用的作用
![03.认证中心auth-server](https://img-blog.csdnimg.cn/img_convert/3fc271b32810a9f2fefd0f2fc18ce134.png)
认证服务器颁发token核心流程
- /oauth/token?grant_type=password #请求授权token
- /oauth/token?grant_type=refresh_token #刷新token
- /oauth/check_token #校验token
- /oauth/authorize #授权码模式
接口地址 http://127.0.0.1:8000/api-auth/doc.html
- 客户端模式
![03.认证中心auth-server](https://img-blog.csdnimg.cn/img_convert/24e13d3e4cb8f4a817385f3a65c94870.png)
- 密码模式
![03.认证中心auth-server](https://img-blog.csdnimg.cn/img_convert/46ff27d25e548652bd0a63de80ad16d6.png)
-
授权码模式
spring-cloud-starter-oauth2项目使用redis-cluster存储token信息报错
![03.认证中心auth-server](https://img-blog.csdnimg.cn/img_convert/2db85ca5475135c867728134ca0d60e1.png)
/**
* @author owen 624191343@qq.com
* @version 创建时间:2017年11月12日 上午22:57:51 类说明 redis集群存储token
*/
public class RedisTemplateTokenStore implements TokenStore {
private static final String ACCESS = "access:";
private static final String AUTH_TO_ACCESS = "auth_to_access:";
private static final String AUTH = "auth:";
private static final String REFRESH_AUTH = "refresh_auth:";
private static final String ACCESS_TO_REFRESH = "access_to_refresh:";
private static final String REFRESH = "refresh:";
private static final String REFRESH_TO_ACCESS = "refresh_to_access:";
private static final String CLIENT_ID_TO_ACCESS = "client_id_to_access:";
private static final String UNAME_TO_ACCESS = "uname_to_access:";
private static final String TOKEN = "token:";
private RedisTemplate<String, Object> redisTemplate;
public RedisTemplate<String, Object> getRedisTemplate()