Skip to content

Commit 5b982ae

Browse files
committed
Re-add sessionRegistry because it's required
1 parent 836874c commit 5b982ae

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

src/main/java/eu/openanalytics/containerproxy/ContainerProxyApplication.java

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@
4343
import org.springframework.security.web.session.HttpSessionEventPublisher;
4444
import org.springframework.session.FindByIndexNameSessionRepository;
4545
import org.springframework.session.Session;
46-
import org.springframework.session.data.redis.config.ConfigureRedisAction;
4746
import org.springframework.session.web.http.DefaultCookieSerializer;
4847
import org.springframework.session.security.SpringSessionBackedSessionRegistry;
4948
import org.springframework.web.filter.FormContentFilter;
@@ -170,6 +169,15 @@ public Health health() {
170169
}
171170
}
172171

172+
/**
173+
* This Bean ensures that User Session are properly expired when using Redis for session storage.
174+
*/
175+
@Bean
176+
@ConditionalOnProperty(name = "spring.session.store-type", havingValue = "redis")
177+
public <S extends Session> SessionRegistry sessionRegistry(FindByIndexNameSessionRepository<S> sessionRepository) {
178+
return new SpringSessionBackedSessionRegistry<S>(sessionRepository);
179+
}
180+
173181
@Bean
174182
public HttpSessionEventPublisher httpSessionEventPublisher() {
175183
return new HttpSessionEventPublisher();

0 commit comments

Comments
 (0)