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
1 changed files with 0 additions and 11 deletions

View File

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