Revert "refactor(gateway): 重写is-login方法,不用响应式,防止阻塞redisson线程"

This reverts commit 892b938313.
This commit is contained in:
liqiang-fit2cloud 2023-04-28 18:39:37 +08:00
parent e26fe4c417
commit 25bd46830d

View File

@ -1,29 +1,18 @@
package io.metersphere.gateway.config;
import io.metersphere.commons.constants.SessionConstants;
import jakarta.annotation.Resource;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.session.data.redis.RedisSessionRepository;
import org.springframework.web.server.session.HeaderWebSessionIdResolver;
import org.springframework.web.server.session.WebSessionIdResolver;
@Configuration
public class SessionConfig {
@Resource
private RedisTemplate<String, Object> redisTemplate;
@Bean
public WebSessionIdResolver webSessionIdResolver() {
HeaderWebSessionIdResolver sessionIdResolver = new HeaderWebSessionIdResolver();
sessionIdResolver.setHeaderName(SessionConstants.HEADER_TOKEN); // Define Session Header Name
return sessionIdResolver;
}
@Bean
public RedisSessionRepository redisSessionRepository() {
return new RedisSessionRepository(redisTemplate);
}
}