优化oauth2客户端

This commit is contained in:
zhou-hao
2017-12-01 15:38:25 +08:00
parent a9fe22eaeb
commit 2fca75ee4e
5 changed files with 47 additions and 2 deletions

View File

@@ -3,5 +3,5 @@
# 模块说明
| 模块 | 说明 | 进度 |
| ------------- |:-------------:| ----|
|[hsweb-authorization-oauth2-client](hsweb-authorization-oauth2-client)|OAuth2 客户端API| 10%|
|[hsweb-authorization-oauth2-server](hsweb-authorization-oauth2-server)|OAuth2 服务端API| 50%|
|[hsweb-authorization-oauth2-client](hsweb-authorization-oauth2-client)|OAuth2 客户端API| 90%|
|[hsweb-authorization-oauth2-server](hsweb-authorization-oauth2-server)|OAuth2 服务端API| 90%|

View File

@@ -23,6 +23,12 @@ public class MemoryOAuth2ServerConfigRepository implements OAuth2ServerConfigRep
return repo.get(id);
}
@Override
public OAuth2ServerConfig save(OAuth2ServerConfig config) {
repo.put(config.getId(), config);
return config;
}
public void setServers(List<OAuth2ServerConfig> servers) {
this.servers = servers;
repo = servers.stream()

View File

@@ -46,6 +46,8 @@ public class MemoryOAuth2UserTokenRepository implements OAuth2UserTokenRepositor
@Override
public AccessTokenInfo insert(AccessTokenInfo accessTokenInfo) {
accessTokenInfo.setCreateTime(System.currentTimeMillis());
accessTokenInfo.setUpdateTime(System.currentTimeMillis());
if (accessTokenInfo.getId() == null) {
accessTokenInfo.setId(IDGenerator.MD5.generate());
}

View File

@@ -8,4 +8,6 @@ import org.hswebframework.web.authorization.oauth2.client.OAuth2ServerConfig;
*/
public interface OAuth2ServerConfigRepository {
OAuth2ServerConfig findById(String id);
OAuth2ServerConfig save(OAuth2ServerConfig config);
}