woody 9 miesięcy temu
rodzic
commit
7648f6eae6

+ 1 - 7
framework-oauth/src/main/java/com/chelvc/framework/oauth/token/DefaultSessionValidator.java

@@ -4,7 +4,6 @@ import java.util.Set;
 
 import com.chelvc.framework.base.context.ApplicationContextHolder;
 import com.chelvc.framework.base.context.SessionContextHolder;
-import com.chelvc.framework.common.util.StringUtils;
 import com.chelvc.framework.oauth.context.OAuthContextHolder;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.security.oauth2.core.OAuth2AuthenticationException;
@@ -44,12 +43,7 @@ public class DefaultSessionValidator implements SessionValidator {
      * @return 应用范围
      */
     protected String getScope(Jwt jwt) {
-        String scope = OAuthContextHolder.getScope(jwt);
-        if (StringUtils.isEmpty(scope)) {
-            // 兼容框架1.0版本
-            return StringUtils.ifEmpty(jwt.getClaimAsString("type"), (String) null);
-        }
-        return scope;
+        return OAuthContextHolder.getScope(jwt);
     }
 
     /**

+ 0 - 6
framework-oauth/src/main/java/com/chelvc/framework/oauth/token/RedisSessionValidator.java

@@ -15,7 +15,6 @@ import com.chelvc.framework.redis.context.RedisContextHolder;
 import com.chelvc.framework.redis.context.RedisHashHolder;
 import com.chelvc.framework.redis.context.RedisUserDailyHashHolder;
 import lombok.RequiredArgsConstructor;
-import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
 import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
@@ -32,7 +31,6 @@ import org.springframework.stereotype.Component;
  * @author Woody
  * @date 2024/1/30
  */
-@Slf4j
 @Component
 @ConditionalOnClass(RedisContextHolder.class)
 @ConditionalOnProperty(value = "oauth.redis.enabled", havingValue = "true", matchIfMissing = true)
@@ -57,10 +55,6 @@ public class RedisSessionValidator extends DefaultSessionValidator {
 
         // 校验令牌有效性及应用范围
         String token = ObjectUtils.get(values, 0), scope = this.getScope(jwt);
-        if (StringUtils.isEmpty(token)) {
-            // 兼容框架1.0版本
-            token = (String) template.opsForValue().get("token:" + terminal + ":" + id);
-        }
         if (StringUtils.isEmpty(token)) {
             throw new OAuth2AuthenticationException(new OAuth2Error(
                     "TOKEN_EXPIRED", ApplicationContextHolder.getMessage("Token.Expired"), null