From 6fb14149d62199cfcc0448c82eb2f51f9c5181de Mon Sep 17 00:00:00 2001
From: luliqiang <kidgrow>
Date: Thu, 31 Dec 2020 16:55:30 +0800
Subject: [PATCH] Merge branch 'dev' of http://192.168.2.240:7070/r/kidgrow-microservices-platform into parter

---
 kidgrow-uaa/kidgrow-uaa-server/src/main/java/com/kidgrow/oauth2/config/AuthorizationServerConfig.java |    9 +++++----
 1 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/kidgrow-uaa/kidgrow-uaa-server/src/main/java/com/kidgrow/oauth2/config/AuthorizationServerConfig.java b/kidgrow-uaa/kidgrow-uaa-server/src/main/java/com/kidgrow/oauth2/config/AuthorizationServerConfig.java
index 84121f2..70df892 100644
--- a/kidgrow-uaa/kidgrow-uaa-server/src/main/java/com/kidgrow/oauth2/config/AuthorizationServerConfig.java
+++ b/kidgrow-uaa/kidgrow-uaa-server/src/main/java/com/kidgrow/oauth2/config/AuthorizationServerConfig.java
@@ -3,10 +3,10 @@
 import com.kidgrow.oauth2.handler.SingleTokenServices;
 import com.kidgrow.oauth2.service.impl.RedisClientDetailsService;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.beans.factory.annotation.Qualifier;
 import org.springframework.boot.autoconfigure.AutoConfigureAfter;
 import org.springframework.context.annotation.Bean;
 import org.springframework.context.annotation.Configuration;
+import org.springframework.context.annotation.Lazy;
 import org.springframework.context.annotation.Primary;
 import org.springframework.security.authentication.AuthenticationManager;
 import org.springframework.security.authentication.AuthenticationProvider;
@@ -80,8 +80,8 @@
     private RandomValueAuthorizationCodeServices authorizationCodeServices;
     @Autowired
     private AuthenticationProvider daoAuhthenticationOauthProvider;
-    @Autowired
-    private SingleTokenServices tokenServices;
+//    @Autowired
+//    private SingleTokenServices tokenServices;
 
 
     /**
@@ -107,7 +107,7 @@
                     @Override
                     public Authentication authenticate(Authentication authentication) throws AuthenticationException {
                         String token = (String) authentication.getPrincipal();
-                        OAuth2Authentication auth = tokenServices.loadAuthentication(token);
+                        OAuth2Authentication auth = KidgrowTokenServices().loadAuthentication(token);
                         if (auth == null) {
                             throw new InvalidTokenException("Invalid token: " + token);
                         }
@@ -134,6 +134,7 @@
 
     @Bean
     @Primary
+    @Lazy
     public SingleTokenServices KidgrowTokenServices(){
         SingleTokenServices tokenServices = new SingleTokenServices();
         tokenServices.setTokenStore(tokenStore);

--
Gitblit v1.8.0