zhaowenyu
2025-12-17 fee6cbe63d4dc2df256e2a6977331e26d84588de
Merge remote-tracking branch 'origin/dev' into dev
1 files modified
8 ■■■■■ changed files
ard-framework/src/main/java/com/ard/framework/security/handle/CustomAuthenticationSuccessHandler.java 8 ●●●●● patch | view | raw | blame | history
ard-framework/src/main/java/com/ard/framework/security/handle/CustomAuthenticationSuccessHandler.java
@@ -4,15 +4,23 @@
import com.ard.common.constant.Constants;
import com.ard.common.core.redis.RedisCache;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
@Component
public class CustomAuthenticationSuccessHandler {
    @Value("${token.soloLogin}")
    private boolean soloLogin;
    @Autowired
    private RedisCache redisCache;
    public void onAuthenticationSuccess(Long userId) {
        // 允许多端登录,直接放行
        if (soloLogin) {
            return;
        }
        // 检查 Redis 中是否已有该用户登录
        String key = CacheConstants.LOGIN_USERID_KEY + userId;
        if (redisCache.hasKey(key)) {