From 78c91d0733ed359957a18db05930977eca75b5e5 Mon Sep 17 00:00:00 2001 From: MichelleChung <1242874891@qq.com> Date: 星期一, 27 十一月 2023 10:56:59 +0800 Subject: [PATCH] !451 响应加密功能 * update 优化调整加解密判断逻辑, 避免 NPE ; * rollback 回滚错误提交, 保留加密组件开关 ; * add 新增注解 @ApiEncrypt 用于校验接口加解密 ; * add 新增 EncryptResponseBodyWrapper 加密响应参数包装类 ; --- ruoyi-common/ruoyi-common-social/src/main/java/org/dromara/common/social/utils/AuthRedisStateCache.java | 16 +++++++++------- 1 files changed, 9 insertions(+), 7 deletions(-) diff --git a/ruoyi-common/ruoyi-common-social/src/main/java/org/dromara/common/social/utils/AuthRedisStateCache.java b/ruoyi-common/ruoyi-common-social/src/main/java/org/dromara/common/social/utils/AuthRedisStateCache.java index d2a4843..0b6ec20 100644 --- a/ruoyi-common/ruoyi-common-social/src/main/java/org/dromara/common/social/utils/AuthRedisStateCache.java +++ b/ruoyi-common/ruoyi-common-social/src/main/java/org/dromara/common/social/utils/AuthRedisStateCache.java @@ -2,15 +2,16 @@ import lombok.AllArgsConstructor; import me.zhyd.oauth.cache.AuthStateCache; +import org.dromara.common.core.constant.GlobalConstants; import org.dromara.common.redis.utils.RedisUtils; -import org.dromara.common.social.config.properties.SocialProperties; import java.time.Duration; +/** + * 鎺堟潈鐘舵�佺紦瀛� + */ @AllArgsConstructor public class AuthRedisStateCache implements AuthStateCache { - - private final SocialProperties socialProperties; /** * 瀛樺叆缂撳瓨 @@ -20,7 +21,8 @@ */ @Override public void cache(String key, String value) { - RedisUtils.setCacheObject(key, value, Duration.ofMillis(socialProperties.getTimeout())); + // 鎺堟潈瓒呮椂鏃堕棿 榛樿涓夊垎閽� + RedisUtils.setCacheObject(GlobalConstants.SOCIAL_AUTH_CODE_KEY + key, value, Duration.ofMinutes(3)); } /** @@ -32,7 +34,7 @@ */ @Override public void cache(String key, String value, long timeout) { - RedisUtils.setCacheObject(key, value, Duration.ofMillis(timeout)); + RedisUtils.setCacheObject(GlobalConstants.SOCIAL_AUTH_CODE_KEY + key, value, Duration.ofMillis(timeout)); } /** @@ -43,7 +45,7 @@ */ @Override public String get(String key) { - return RedisUtils.getCacheObject(key); + return RedisUtils.getCacheObject(GlobalConstants.SOCIAL_AUTH_CODE_KEY + key); } /** @@ -54,6 +56,6 @@ */ @Override public boolean containsKey(String key) { - return RedisUtils.hasKey(key); + return RedisUtils.hasKey(GlobalConstants.SOCIAL_AUTH_CODE_KEY + key); } } -- Gitblit v1.9.3