mirror of
				https://github.com/continew-org/continew-starter.git
				synced 2025-10-31 22:57:19 +08:00 
			
		
		
		
	refactor: 优化 JustAuth 自动配置(认证模块),使用自定义 JustAuth State 缓存 Redis 实现
This commit is contained in:
		| @@ -19,7 +19,9 @@ package top.charles7c.continew.starter.auth.justauth.autoconfigure; | ||||
| import jakarta.annotation.PostConstruct; | ||||
| import lombok.extern.slf4j.Slf4j; | ||||
| import me.zhyd.oauth.cache.AuthStateCache; | ||||
| import org.redisson.client.RedisClient; | ||||
| import org.springframework.boot.autoconfigure.AutoConfiguration; | ||||
| import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; | ||||
| import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; | ||||
| import org.springframework.context.annotation.Bean; | ||||
| import top.charles7c.continew.starter.auth.justauth.impl.JustAuthStateCacheRedisImpl; | ||||
| @@ -31,7 +33,7 @@ import top.charles7c.continew.starter.auth.justauth.impl.JustAuthStateCacheRedis | ||||
|  * @since 1.0.0 | ||||
|  */ | ||||
| @Slf4j | ||||
| @AutoConfiguration(after = com.xkcoding.justauth.autoconfigure.JustAuthAutoConfiguration.class) | ||||
| @AutoConfiguration(before = com.xkcoding.justauth.autoconfigure.JustAuthAutoConfiguration.class) | ||||
| @ConditionalOnProperty(prefix = "justauth", value = "enabled", havingValue = "true", matchIfMissing = true) | ||||
| public class JustAuthAutoConfiguration { | ||||
|  | ||||
| @@ -39,9 +41,12 @@ public class JustAuthAutoConfiguration { | ||||
|      * 自定义 State 缓存实现 | ||||
|      */ | ||||
|     @Bean | ||||
|     @ConditionalOnProperty(prefix = "justauth.cache", value = "type", havingValue = "custom") | ||||
|     @ConditionalOnClass(RedisClient.class) | ||||
|     @ConditionalOnProperty(prefix = "justauth.cache", value = "type", havingValue = "redis") | ||||
|     public AuthStateCache authStateCache() { | ||||
|         return new JustAuthStateCacheRedisImpl(); | ||||
|         JustAuthStateCacheRedisImpl impl = new JustAuthStateCacheRedisImpl(); | ||||
|         log.debug("[ContiNew Starter] - Auto Configuration 'JustAuth-AuthStateCache-Redis' completed initialization."); | ||||
|         return impl; | ||||
|     } | ||||
|  | ||||
|     @PostConstruct | ||||
|   | ||||
| @@ -22,7 +22,7 @@ import top.charles7c.continew.starter.cache.redisson.util.RedisUtils; | ||||
| import java.time.Duration; | ||||
|  | ||||
| /** | ||||
|  * Just Auth 自定义 State 缓存实现(Redis) | ||||
|  * JustAuth State 缓存 Redis 实现 | ||||
|  * | ||||
|  * @author Charles7c | ||||
|  * @since 1.0.0 | ||||
|   | ||||
| @@ -38,7 +38,7 @@ import top.charles7c.continew.starter.cache.redisson.autoconfigure.RedissonAutoC | ||||
|  */ | ||||
| @Slf4j | ||||
| @NoArgsConstructor(access = AccessLevel.PRIVATE) | ||||
| public abstract class SaTokenDaoConfiguration { | ||||
| abstract class SaTokenDaoConfiguration { | ||||
|  | ||||
|     /** | ||||
|      * 自定义持久层实现类-Redis | ||||
|   | ||||
		Reference in New Issue
	
	Block a user