zhou-hao 7 лет назад
Родитель
Сommit
e0200585af
11 измененных файлов с 285 добавлено и 176 удалено
  1. 51 0
      hsweb-authorization/hsweb-authorization-oauth2/hsweb-authorization-oauth2-auth-server/src/main/java/org/hswebframework/web/authorization/oauth2/server/client/MemoryOAuth2ClientConfigRepository.java
  2. 11 3
      hsweb-authorization/hsweb-authorization-oauth2/hsweb-authorization-oauth2-auth-server/src/main/java/org/hswebframework/web/authorization/oauth2/server/client/OAuth2ClientService.java
  3. 31 0
      hsweb-authorization/hsweb-authorization-oauth2/hsweb-authorization-oauth2-auth-server/src/main/java/org/hswebframework/web/authorization/oauth2/server/client/SimpleOAuth2Client.java
  4. 8 8
      hsweb-authorization/hsweb-authorization-oauth2/hsweb-authorization-oauth2-auth-server/src/main/java/org/hswebframework/web/authorization/oauth2/server/support/AbstractAuthorizationService.java
  5. 2 2
      hsweb-system/hsweb-system-oauth2-client/hsweb-system-oauth2-client-controller/src/main/java/org/hswebframework/web/authorization/oauth2/controller/OAuth2ClientController.java
  6. 1 1
      hsweb-system/hsweb-system-oauth2-client/hsweb-system-oauth2-client-controller/src/main/java/org/hswebframework/web/authorization/oauth2/controller/OAuth2UserTokenController.java
  7. 63 0
      hsweb-system/hsweb-system-oauth2-server/hsweb-system-oauth2-server-controller/src/main/java/org/hswebframework/web/authorization/oauth2/controller/OAuth2ClientConfigController.java
  8. 7 109
      hsweb-system/hsweb-system-oauth2-server/hsweb-system-oauth2-server-entity/src/main/java/org/hswebframework/web/authorization/oauth2/server/entity/SimpleOAuth2ClientEntity.java
  9. 105 0
      hsweb-system/hsweb-system-oauth2-server/hsweb-system-oauth2-server-simple/src/main/java/org/hswebframework/web/service/oauth2/server/simple/SimpleClientConfigRepository.java
  10. 0 47
      hsweb-system/hsweb-system-oauth2-server/hsweb-system-oauth2-server-simple/src/main/java/org/hswebframework/web/service/oauth2/server/simple/SimpleClientService.java
  11. 6 6
      hsweb-system/hsweb-system-oauth2-server/hsweb-system-oauth2-server-starter/src/main/java/org/hswebframework/web/oauth2/OAuth2GranterAutoConfiguration.java

+ 51 - 0
hsweb-authorization/hsweb-authorization-oauth2/hsweb-authorization-oauth2-auth-server/src/main/java/org/hswebframework/web/authorization/oauth2/server/client/MemoryOAuth2ClientConfigRepository.java

@@ -0,0 +1,51 @@
+package org.hswebframework.web.authorization.oauth2.server.client;
+
+import org.hswebframework.web.id.IDGenerator;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+public class MemoryOAuth2ClientConfigRepository implements OAuth2ClientConfigRepository {
+    private Map<String, OAuth2Client> clients = new HashMap<>();
+
+    public void setClients(Map<String, OAuth2Client> clients) {
+        this.clients = clients;
+    }
+
+    @Override
+    public OAuth2Client getClientById(String id) {
+        return clients.get(id);
+    }
+
+    @Override
+    public OAuth2Client getClientByOwnerId(String ownerId) {
+        return clients.values().stream().filter(client -> ownerId.equals(client.getOwnerId())).findFirst().orElse(null);
+    }
+
+    @Override
+    public OAuth2Client save(OAuth2Client oAuth2Client) {
+        clients.put(oAuth2Client.getId(), oAuth2Client);
+        return oAuth2Client;
+    }
+
+    @Override
+    public OAuth2Client newClient() {
+        return SimpleOAuth2Client.builder()
+                .id(IDGenerator.MD5.generate())
+                .secret(IDGenerator.MD5.generate())
+                .build();
+    }
+
+    @Override
+    public OAuth2Client remove(String id) {
+        return clients.remove(id);
+    }
+
+    @Override
+    public List<OAuth2Client> getAll() {
+        return new ArrayList<>(clients.values());
+    }
+
+}

+ 11 - 3
hsweb-authorization/hsweb-authorization-oauth2/hsweb-authorization-oauth2-auth-server/src/main/java/org/hswebframework/web/authorization/oauth2/server/client/OAuth2ClientService.java

@@ -18,13 +18,21 @@
 
 package org.hswebframework.web.authorization.oauth2.server.client;
 
+import java.util.List;
+
 /**
- * TODO 完成注释
- *
  * @author zhouhao
  */
-public interface OAuth2ClientService {
+public interface OAuth2ClientConfigRepository {
     OAuth2Client getClientById(String id);
 
     OAuth2Client getClientByOwnerId(String ownerId);
+
+    OAuth2Client save(OAuth2Client oAuth2Client);
+
+    OAuth2Client remove(String id);
+
+    OAuth2Client newClient();
+
+    List<OAuth2Client> getAll();
 }

+ 31 - 0
hsweb-authorization/hsweb-authorization-oauth2/hsweb-authorization-oauth2-auth-server/src/main/java/org/hswebframework/web/authorization/oauth2/server/client/SimpleOAuth2Client.java

@@ -0,0 +1,31 @@
+package org.hswebframework.web.authorization.oauth2.server.client;
+
+import lombok.*;
+
+import java.util.Set;
+
+@Getter
+@Setter
+@NoArgsConstructor
+@AllArgsConstructor
+@Builder
+public class SimpleOAuth2Client implements OAuth2Client {
+    private static final long serialVersionUID = -9179482283099879369L;
+    private String id;
+
+    private String secret;
+
+    private String name;
+
+    private String redirectUri;
+
+    private String ownerId;
+
+    private Long createTime;
+
+    private Byte status;
+
+    private Set<String> supportGrantTypes;
+
+    private Set<String> DefaultGrantScope;
+}

+ 8 - 8
hsweb-authorization/hsweb-authorization-oauth2/hsweb-authorization-oauth2-auth-server/src/main/java/org/hswebframework/web/authorization/oauth2/server/support/AbstractAuthorizationService.java

@@ -19,7 +19,7 @@
 package org.hswebframework.web.authorization.oauth2.server.support;
 
 import org.hswebframework.web.authorization.oauth2.server.client.OAuth2Client;
-import org.hswebframework.web.authorization.oauth2.server.client.OAuth2ClientService;
+import org.hswebframework.web.authorization.oauth2.server.client.OAuth2ClientConfigRepository;
 import org.hswebframework.web.authorization.oauth2.server.exception.GrantTokenException;
 import org.hswebframework.web.authorization.oauth2.server.token.AccessTokenService;
 import org.hswebframework.web.commons.entity.DataStatus;
@@ -32,7 +32,7 @@ import static org.hswebframework.web.oauth2.core.ErrorType.*;
  */
 public abstract class AbstractAuthorizationService {
     protected AccessTokenService  accessTokenService;
-    protected OAuth2ClientService clientService;
+    protected OAuth2ClientConfigRepository repository;
 
     public AccessTokenService getAccessTokenService() {
         return accessTokenService;
@@ -42,12 +42,12 @@ public abstract class AbstractAuthorizationService {
         this.accessTokenService = accessTokenService;
     }
 
-    public OAuth2ClientService getClientService() {
-        return clientService;
+    public OAuth2ClientConfigRepository getRepository() {
+        return repository;
     }
 
-    public void setClientService(OAuth2ClientService clientService) {
-        this.clientService = clientService;
+    public void setRepository(OAuth2ClientConfigRepository repository) {
+        this.repository = repository;
     }
 
     protected void assertGrantTypeSupport(OAuth2Client client, String grantType) {
@@ -81,11 +81,11 @@ public abstract class AbstractAuthorizationService {
     }
 
     protected OAuth2Client getClientByOwnerId(String ownerId) {
-        return checkClient(clientService.getClientByOwnerId(ownerId));
+        return checkClient(repository.getClientByOwnerId(ownerId));
     }
 
     protected OAuth2Client getClient(String clientId) {
-        return checkClient(clientService.getClientById(clientId));
+        return checkClient(repository.getClientById(clientId));
     }
 
 }

+ 2 - 2
hsweb-system/hsweb-system-oauth2-client/hsweb-system-oauth2-client-controller/src/main/java/org/hswebframework/web/authorization/oauth2/controller/OAuth2ClientController.java

@@ -21,12 +21,12 @@ package org.hswebframework.web.authorization.oauth2.controller;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import org.hswebframework.web.WebUtil;
-import org.hswebframework.web.authorization.oauth2.client.OAuth2Constants;
 import org.hswebframework.web.authorization.oauth2.client.OAuth2RequestService;
 import org.hswebframework.web.authorization.oauth2.client.listener.OAuth2CodeAuthBeforeEvent;
 import org.hswebframework.web.controller.message.ResponseMessage;
 import org.hswebframework.web.entity.oauth2.client.OAuth2ServerConfigEntity;
 import org.hswebframework.web.id.IDGenerator;
+import org.hswebframework.web.oauth2.core.OAuth2Constants;
 import org.hswebframework.web.service.oauth2.client.OAuth2ServerConfigService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Controller;
@@ -44,7 +44,7 @@ import java.net.URLEncoder;
  */
 @Controller
 @RequestMapping("${hsweb.web.mappings.oauth2-client-callback:oauth2}")
-@Api(tags = "OAuth2.0-客户端请求", value = "OAuth2.0客户端")
+@Api(tags = "OAuth2.0-客户端", value = "OAuth2.0客户端")
 public class OAuth2ClientController {
 
     private OAuth2RequestService oAuth2RequestService;

+ 1 - 1
hsweb-system/hsweb-system-oauth2-client/hsweb-system-oauth2-client-controller/src/main/java/org/hswebframework/web/authorization/oauth2/controller/OAuth2UserTokenController.java

@@ -38,7 +38,7 @@ import org.springframework.web.bind.annotation.RestController;
 @RestController
 @RequestMapping("${hsweb.web.mappings.oauth2-user-token:oauth2-user-token}")
 @Authorize(permission = "oauth2-user-token")
-@Api(tags = "OAuth2.0-客户端用户授权信息",value = "OAuth2.0客户端授权信息")
+@Api(tags = "OAuth2.0-客户端用token信息",value = "OAuth2.0客户端token信息")
 public class OAuth2UserTokenController
         implements QueryController<OAuth2UserTokenEntity, String, QueryParamEntity> {
 

+ 63 - 0
hsweb-system/hsweb-system-oauth2-server/hsweb-system-oauth2-server-controller/src/main/java/org/hswebframework/web/authorization/oauth2/controller/OAuth2ClientConfigController.java

@@ -0,0 +1,63 @@
+package org.hswebframework.web.authorization.oauth2.controller;
+
+
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import org.hswebframework.web.authorization.Permission;
+import org.hswebframework.web.authorization.annotation.Authorize;
+import org.hswebframework.web.authorization.oauth2.server.client.OAuth2Client;
+import org.hswebframework.web.authorization.oauth2.server.client.OAuth2ClientConfigRepository;
+import org.hswebframework.web.authorization.oauth2.server.entity.OAuth2ClientEntity;
+import org.hswebframework.web.controller.message.ResponseMessage;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.List;
+
+@RestController
+@RequestMapping("/oauth2/client/config")
+@Api(tags = "OAuth2.0-客户端管理", value = "OAuth2.0客户端管理")
+@Authorize(permission = "oauth2-client-config", description = "OAuth2.0客户端管理")
+public class OAuth2ClientConfigController {
+
+    @Autowired
+    private OAuth2ClientConfigRepository repository;
+
+    @GetMapping
+    @Authorize(action = Permission.ACTION_QUERY)
+    @ApiOperation("获取全部客户端")
+    public ResponseMessage<List<OAuth2Client>> getAllClient() {
+        return ResponseMessage.ok(repository.getAll());
+    }
+
+
+    @GetMapping("/{id}")
+    @Authorize(action = Permission.ACTION_GET)
+    @ApiOperation("根据id获取客户端")
+    public ResponseMessage<OAuth2Client> getById(@PathVariable String id) {
+        return ResponseMessage.ok(repository.getClientById(id));
+    }
+
+    @GetMapping("/owner/{userId}")
+    @Authorize(action = Permission.ACTION_GET)
+    @ApiOperation("根据绑定到用户到客户端")
+    public ResponseMessage<OAuth2Client> getByOwnerId(@PathVariable String userId) {
+        return ResponseMessage.ok(repository.getClientByOwnerId(userId));
+    }
+
+
+    @PatchMapping
+    @Authorize(action = Permission.ACTION_UPDATE)
+    @ApiOperation(value = "保存客户端", notes = "如果客户端不存在则自动新增")
+    public ResponseMessage<OAuth2Client> saveOrUpdate(@RequestBody OAuth2ClientEntity clientEntity) {
+        return ResponseMessage.ok(repository.save(clientEntity));
+    }
+
+    @DeleteMapping("/{id}")
+    @Authorize(action = Permission.ACTION_DELETE)
+    @ApiOperation(value = "删除客户端")
+    public ResponseMessage<OAuth2Client> removeById(@PathVariable String id) {
+        return ResponseMessage.ok(repository.remove(id));
+    }
+
+}

+ 7 - 109
hsweb-system/hsweb-system-oauth2-server/hsweb-system-oauth2-server-entity/src/main/java/org/hswebframework/web/authorization/oauth2/server/entity/SimpleOAuth2ClientEntity.java

@@ -18,6 +18,7 @@
 
 package org.hswebframework.web.authorization.oauth2.server.entity;
 
+import lombok.*;
 import org.hswebframework.web.commons.entity.SimpleGenericEntity;
 
 import java.util.Set;
@@ -25,7 +26,13 @@ import java.util.Set;
 /**
  * @author zhouhao
  */
+@Getter
+@Setter
+@NoArgsConstructor
+@AllArgsConstructor
+@Builder
 public class SimpleOAuth2ClientEntity extends SimpleGenericEntity<String> implements OAuth2ClientEntity {
+    private static final long serialVersionUID = -8370400980996896599L;
     private String name;
 
     private String secret;
@@ -48,113 +55,4 @@ public class SimpleOAuth2ClientEntity extends SimpleGenericEntity<String> implem
 
     private Byte status;
 
-    @Override
-    public String getDescribe() {
-        return describe;
-    }
-
-    @Override
-    public void setDescribe(String describe) {
-        this.describe = describe;
-    }
-
-    @Override
-    public String getName() {
-        return name;
-    }
-
-    @Override
-    public void setName(String name) {
-        this.name = name;
-    }
-
-    @Override
-    public String getSecret() {
-        return secret;
-    }
-
-    @Override
-    public void setSecret(String secret) {
-        this.secret = secret;
-    }
-
-    @Override
-    public String getRedirectUri() {
-        return redirectUri;
-    }
-
-    @Override
-    public void setRedirectUri(String redirectUri) {
-        this.redirectUri = redirectUri;
-    }
-
-    @Override
-    public String getOwnerId() {
-        return ownerId;
-    }
-
-    @Override
-    public void setOwnerId(String ownerId) {
-        this.ownerId = ownerId;
-    }
-
-    @Override
-    public String getCreatorId() {
-        return creatorId;
-    }
-
-    @Override
-    public void setCreatorId(String creatorId) {
-        this.creatorId = creatorId;
-    }
-
-    @Override
-    public Long getCreateTime() {
-        return createTime;
-    }
-
-    @Override
-    public void setCreateTime(Long createTime) {
-        this.createTime = createTime;
-    }
-
-    @Override
-    public String getType() {
-        return type;
-    }
-
-    @Override
-    public void setType(String type) {
-        this.type = type;
-    }
-
-    @Override
-    public Set<String> getSupportGrantTypes() {
-        return supportGrantTypes;
-    }
-
-    @Override
-    public void setSupportGrantTypes(Set<String> supportGrantType) {
-        this.supportGrantTypes = supportGrantType;
-    }
-
-    @Override
-    public Set<String> getDefaultGrantScope() {
-        return defaultGrantScope;
-    }
-
-    @Override
-    public void setDefaultGrantScope(Set<String> defaultGrantScope) {
-        this.defaultGrantScope = defaultGrantScope;
-    }
-
-    @Override
-    public Byte getStatus() {
-        return status;
-    }
-
-    @Override
-    public void setStatus(Byte status) {
-        this.status = status;
-    }
 }

+ 105 - 0
hsweb-system/hsweb-system-oauth2-server/hsweb-system-oauth2-server-simple/src/main/java/org/hswebframework/web/service/oauth2/server/simple/SimpleClientConfigRepository.java

@@ -0,0 +1,105 @@
+/*
+ *  Copyright 2016 http://www.hswebframework.org
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *        http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ *
+ *
+ */
+
+package org.hswebframework.web.service.oauth2.server.simple;
+
+import org.hswebframework.web.authorization.oauth2.server.client.OAuth2Client;
+import org.hswebframework.web.authorization.oauth2.server.client.OAuth2ClientConfigRepository;
+import org.hswebframework.web.authorization.oauth2.server.entity.OAuth2ClientEntity;
+import org.hswebframework.web.authorization.oauth2.server.entity.SimpleOAuth2ClientEntity;
+import org.hswebframework.web.commons.entity.DataStatus;
+import org.hswebframework.web.commons.entity.param.QueryParamEntity;
+import org.hswebframework.web.dao.oauth2.OAuth2ClientDao;
+import org.hswebframework.web.id.IDGenerator;
+import org.hswebframework.web.service.DefaultDSLQueryService;
+import org.hswebframework.web.service.DefaultDSLUpdateService;
+import org.springframework.cache.annotation.*;
+
+import java.util.List;
+
+/**
+ * @author zhouhao
+ */
+@CacheConfig(cacheNames = "oauth2-client-config")
+public class SimpleClientConfigRepository implements OAuth2ClientConfigRepository {
+    private OAuth2ClientDao oAuth2ClientDao;
+
+    public SimpleClientConfigRepository(OAuth2ClientDao oAuth2ClientDao) {
+        this.oAuth2ClientDao = oAuth2ClientDao;
+    }
+
+    @Override
+    @Cacheable(key = "'id:'+#id")
+    public OAuth2Client getClientById(String id) {
+        return DefaultDSLQueryService.createQuery(oAuth2ClientDao).where("id", id).single();
+    }
+
+    @Override
+    @Cacheable(key = "'ownerId:'+#id")
+    public OAuth2Client getClientByOwnerId(String ownerId) {
+        return DefaultDSLQueryService.createQuery(oAuth2ClientDao).where("ownerId", ownerId).single();
+    }
+
+    @Override
+    @Caching(put = {
+            @CachePut(key = "'ownerId:'+#result.ownerId"),
+            @CachePut(key = "'id:'+#result.id")
+    })
+    public OAuth2Client save(OAuth2Client oAuth2Client) {
+        OAuth2Client old = getClientById(oAuth2Client.getId());
+        if (old != null) {
+            DefaultDSLUpdateService
+                    .createUpdate(oAuth2ClientDao, oAuth2Client)
+                    .excludes("id", "createTime")
+                    .where("id", oAuth2Client.getId()).exec();
+        } else {
+            oAuth2ClientDao.insert(((SimpleOAuth2ClientEntity) oAuth2Client));
+        }
+        return oAuth2Client;
+    }
+
+    @Override
+    @Caching(evict = {
+            @CacheEvict(key = "'ownerId:'+#result.ownerId", condition = "#result!=null"),
+            @CacheEvict(key = "'id:'+#result.id", condition = "#result!=null")
+    })
+    public OAuth2Client remove(String id) {
+        OAuth2Client old = getClientById(id);
+        oAuth2ClientDao.deleteByPk(id);
+        return old;
+    }
+
+    @Override
+    public OAuth2Client newClient() {
+        SimpleOAuth2ClientEntity clientEntity = SimpleOAuth2ClientEntity.builder()
+                .build();
+        clientEntity.setId(IDGenerator.MD5.generate());
+        clientEntity.setSecret(IDGenerator.MD5.generate());
+        clientEntity.setStatus(DataStatus.STATUS_ENABLED);
+        clientEntity.setCreateTimeNow();
+        return clientEntity;
+    }
+
+    @Override
+    @SuppressWarnings("unchecked")
+    public List<OAuth2Client> getAll() {
+        QueryParamEntity entity = new QueryParamEntity();
+        entity.setPaging(false);
+        return (List) oAuth2ClientDao.query(entity);
+    }
+}

+ 0 - 47
hsweb-system/hsweb-system-oauth2-server/hsweb-system-oauth2-server-simple/src/main/java/org/hswebframework/web/service/oauth2/server/simple/SimpleClientService.java

@@ -1,47 +0,0 @@
-/*
- *  Copyright 2016 http://www.hswebframework.org
- *
- *  Licensed under the Apache License, Version 2.0 (the "License");
- *  you may not use this file except in compliance with the License.
- *  You may obtain a copy of the License at
- *
- *        http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing, software
- *  distributed under the License is distributed on an "AS IS" BASIS,
- *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *  See the License for the specific language governing permissions and
- *  limitations under the License.
- *
- *
- */
-
-package org.hswebframework.web.service.oauth2.server.simple;
-
-import org.hswebframework.web.authorization.oauth2.server.client.OAuth2Client;
-import org.hswebframework.web.authorization.oauth2.server.client.OAuth2ClientService;
-import org.hswebframework.web.dao.oauth2.OAuth2ClientDao;
-import org.hswebframework.web.service.DefaultDSLQueryService;
-
-/**
- * TODO 完成注释
- *
- * @author zhouhao
- */
-public class SimpleClientService implements OAuth2ClientService {
-    private OAuth2ClientDao oAuth2ClientDao;
-
-    public SimpleClientService(OAuth2ClientDao oAuth2ClientDao) {
-        this.oAuth2ClientDao = oAuth2ClientDao;
-    }
-
-    @Override
-    public OAuth2Client getClientById(String id) {
-        return DefaultDSLQueryService.createQuery(oAuth2ClientDao).where("id", id).single();
-    }
-
-    @Override
-    public OAuth2Client getClientByOwnerId(String ownerId) {
-        return DefaultDSLQueryService.createQuery(oAuth2ClientDao).where("ownerId", ownerId).single();
-    }
-}

+ 6 - 6
hsweb-system/hsweb-system-oauth2-server/hsweb-system-oauth2-server-starter/src/main/java/org/hswebframework/web/oauth2/OAuth2GranterAutoConfiguration.java

@@ -18,7 +18,7 @@
 
 package org.hswebframework.web.oauth2;
 
-import org.hswebframework.web.authorization.oauth2.server.client.OAuth2ClientService;
+import org.hswebframework.web.authorization.oauth2.server.client.OAuth2ClientConfigRepository;
 import org.hswebframework.web.authorization.oauth2.server.support.AbstractAuthorizationService;
 import org.hswebframework.web.authorization.oauth2.server.support.DefaultOAuth2Granter;
 import org.hswebframework.web.authorization.oauth2.server.support.client.ClientCredentialGranter;
@@ -72,10 +72,10 @@ public class OAuth2GranterAutoConfiguration {
                 .setCodeGenerator(codeGenerator);
     }
 
-    @ConditionalOnMissingBean(OAuth2ClientService.class)
+    @ConditionalOnMissingBean(OAuth2ClientConfigRepository.class)
     @Bean
-    public SimpleClientService simpleClientService(OAuth2ClientDao oAuth2ClientDao) {
-        return new SimpleClientService(oAuth2ClientDao);
+    public SimpleClientConfigRepository simpleClientService(OAuth2ClientDao oAuth2ClientDao) {
+        return new SimpleClientConfigRepository(oAuth2ClientDao);
     }
 
     @ConditionalOnMissingBean(PasswordService.class)
@@ -96,7 +96,7 @@ public class OAuth2GranterAutoConfiguration {
         @Autowired
         private AuthorizationCodeService authorizationCodeService;
         @Autowired
-        private OAuth2ClientService      oAuth2ClientService;
+        private OAuth2ClientConfigRepository oAuth2ClientConfigRepository;
         @Autowired
         private AccessTokenService       accessTokenService;
         @Autowired
@@ -104,7 +104,7 @@ public class OAuth2GranterAutoConfiguration {
 
         private <T extends AbstractAuthorizationService> T setProperty(T abstractAuthorizationService) {
             abstractAuthorizationService.setAccessTokenService(accessTokenService);
-            abstractAuthorizationService.setClientService(oAuth2ClientService);
+            abstractAuthorizationService.setRepository(oAuth2ClientConfigRepository);
             return abstractAuthorizationService;
         }