From dbf4d6c7131f54d3a32c356dfe1a98c83ba6ff78 Mon Sep 17 00:00:00 2001
From: 疯狂的狮子Li <15040126243@163.com>
Date: 星期三, 12 七月 2023 17:05:37 +0800
Subject: [PATCH] update 更新 readme 关于接口加密说明
---
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