diff --git a/docs/src/docs/asciidoc/index.adoc b/docs/src/docs/asciidoc/index.adoc
index de808872..361498e0 100644
--- a/docs/src/docs/asciidoc/index.adoc
+++ b/docs/src/docs/asciidoc/index.adoc
@@ -416,7 +416,7 @@ include::{docs-test-dir}docs/security/SecurityConfiguration.java[tags=class]
----
This assumes that you've also configured Spring Session to provide a `FindByIndexNameSessionRepository` that
-returns `ExpiringSession` instances.
+returns `Session` instances.
When using XML configuration, it would look something like this:
[source,xml,indent=0]
@@ -458,11 +458,7 @@ include::{indexdoc-tests}[tags=repository-demo]
<5> We retrieve the `Session` from the `SessionRepository`.
<6> We obtain the persisted `User` from our `Session` without the need for explicitly casting our attribute.
-[[api-expiringsession]]
-=== ExpiringSession
-
-An `ExpiringSession` extends a `Session` by providing attributes related to the `Session` instance's expiration.
-If there is no need to interact with the expiration information, prefer using the more simple `Session` API.
+`Session` API also provides attributes related to the `Session` instance's expiration.
Typical usage might look like the following:
@@ -471,17 +467,17 @@ Typical usage might look like the following:
include::{indexdoc-tests}[tags=expire-repository-demo]
----
-<1> We create a `SessionRepository` instance with a generic type, `S`, that extends `ExpiringSession`. The generic type is defined in our class.
-<2> We create a new `ExpiringSession` using our `SessionRepository` and assign it to a variable of type `S`.
-<3> We interact with the `ExpiringSession`.
-In our example, we demonstrate updating the amount of time the `ExpiringSession` can be inactive before it expires.
-<4> We now save the `ExpiringSession`.
+<1> We create a `SessionRepository` instance with a generic type, `S`, that extends `Session`. The generic type is defined in our class.
+<2> We create a new `Session` using our `SessionRepository` and assign it to a variable of type `S`.
+<3> We interact with the `Session`.
+In our example, we demonstrate updating the amount of time the `Session` can be inactive before it expires.
+<4> We now save the `Session`.
This is why we needed the generic type `S`.
-The `SessionRepository` only allows saving `ExpiringSession` instances that were created or retrieved using the same `SessionRepository`.
+The `SessionRepository` only allows saving `Session` instances that were created or retrieved using the same `SessionRepository`.
This allows for the `SessionRepository` to make implementation specific optimizations (i.e. only writing attributes that have changed).
-The last accessed time is automatically updated when the `ExpiringSession` is saved.
-<5> We retrieve the `ExpiringSession` from the `SessionRepository`.
-If the `ExpiringSession` were expired, the result would be null.
+The last accessed time is automatically updated when the `Session` is saved.
+<5> We retrieve the `Session` from the `SessionRepository`.
+If the `Session` were expired, the result would be null.
[[api-sessionrepository]]
=== SessionRepository
@@ -640,7 +636,7 @@ HMSET spring:session:sessions:33fdd1b6-b496-4b33-9f7d-df96679d32fe sessionAttr:a
[[api-redisoperationssessionrepository-expiration]]
===== Session Expiration
-An expiration is associated to each session using the EXPIRE command based upon the `ExpiringSession.getMaxInactiveInterval()`.
+An expiration is associated to each session using the EXPIRE command based upon the `Session.getMaxInactiveInterval()`.
For example:
----
@@ -776,7 +772,7 @@ redis 127.0.0.1:6379> hget spring:session:sessions:4fc39ce3-63b3-4e17-b1c4-5e1ed
[[api-mapsessionrepository]]
=== MapSessionRepository
-The `MapSessionRepository` allows for persisting `ExpiringSession` in a `Map` with the key being the `ExpiringSession` id and the value being the `ExpiringSession`.
+The `MapSessionRepository` allows for persisting `Session` in a `Map` with the key being the `Session` id and the value being the `Session`.
The implementation can be used with a `ConcurrentHashMap` as a testing or convenience mechanism.
Alternatively, it can be used with distributed `Map` implementations. For example, it can be used with Hazelcast.
diff --git a/docs/src/test/java/docs/HttpSessionConfigurationNoOpConfigureRedisActionXmlTests.java b/docs/src/test/java/docs/HttpSessionConfigurationNoOpConfigureRedisActionXmlTests.java
index 9b4d33c4..e63dad53 100644
--- a/docs/src/test/java/docs/HttpSessionConfigurationNoOpConfigureRedisActionXmlTests.java
+++ b/docs/src/test/java/docs/HttpSessionConfigurationNoOpConfigureRedisActionXmlTests.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2014-2016 the original author or authors.
+ * Copyright 2014-2017 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -21,7 +21,7 @@ import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.connection.RedisConnectionFactory;
-import org.springframework.session.ExpiringSession;
+import org.springframework.session.Session;
import org.springframework.session.web.http.SessionRepositoryFilter;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
@@ -38,7 +38,7 @@ import static org.mockito.Mockito.mock;
@WebAppConfiguration
public class HttpSessionConfigurationNoOpConfigureRedisActionXmlTests {
@Autowired
- SessionRepositoryFilter extends ExpiringSession> filter;
+ SessionRepositoryFilter extends Session> filter;
@Test
public void redisConnectionFactoryNotUsedSinceNoValidation() {
diff --git a/docs/src/test/java/docs/IndexDocTests.java b/docs/src/test/java/docs/IndexDocTests.java
index 836ff150..6704f62d 100644
--- a/docs/src/test/java/docs/IndexDocTests.java
+++ b/docs/src/test/java/docs/IndexDocTests.java
@@ -26,7 +26,6 @@ import org.springframework.data.redis.connection.lettuce.LettuceConnectionFactor
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.jdbc.datasource.DataSourceTransactionManager;
import org.springframework.mock.web.MockServletContext;
-import org.springframework.session.ExpiringSession;
import org.springframework.session.MapSession;
import org.springframework.session.MapSessionRepository;
import org.springframework.session.Session;
@@ -49,7 +48,7 @@ public class IndexDocTests {
@Test
public void repositoryDemo() {
- RepositoryDemo demo = new RepositoryDemo<>();
+ RepositoryDemo demo = new RepositoryDemo<>();
demo.repository = new MapSessionRepository();
demo.demo();
@@ -81,14 +80,14 @@ public class IndexDocTests {
@Test
public void expireRepositoryDemo() {
- ExpiringRepositoryDemo demo = new ExpiringRepositoryDemo<>();
+ ExpiringRepositoryDemo demo = new ExpiringRepositoryDemo<>();
demo.repository = new MapSessionRepository();
demo.demo();
}
// tag::expire-repository-demo[]
- public class ExpiringRepositoryDemo {
+ public class ExpiringRepositoryDemo {
private SessionRepository repository; // <1>
public void demo() {
@@ -111,7 +110,7 @@ public class IndexDocTests {
public void newRedisOperationsSessionRepository() {
// tag::new-redisoperationssessionrepository[]
LettuceConnectionFactory factory = new LettuceConnectionFactory();
- SessionRepository extends ExpiringSession> repository = new RedisOperationsSessionRepository(
+ SessionRepository extends Session> repository = new RedisOperationsSessionRepository(
factory);
// end::new-redisoperationssessionrepository[]
}
@@ -120,7 +119,7 @@ public class IndexDocTests {
@SuppressWarnings("unused")
public void mapRepository() {
// tag::new-mapsessionrepository[]
- SessionRepository extends ExpiringSession> repository = new MapSessionRepository();
+ SessionRepository extends Session> repository = new MapSessionRepository();
// end::new-mapsessionrepository[]
}
@@ -136,7 +135,7 @@ public class IndexDocTests {
// ... configure transactionManager ...
- SessionRepository extends ExpiringSession> repository =
+ SessionRepository extends Session> repository =
new JdbcOperationsSessionRepository(jdbcTemplate, transactionManager);
// end::new-jdbcoperationssessionrepository[]
}
diff --git a/docs/src/test/java/docs/security/RememberMeSecurityConfigurationTests.java b/docs/src/test/java/docs/security/RememberMeSecurityConfigurationTests.java
index 2b45cace..fdd4b629 100644
--- a/docs/src/test/java/docs/security/RememberMeSecurityConfigurationTests.java
+++ b/docs/src/test/java/docs/security/RememberMeSecurityConfigurationTests.java
@@ -26,7 +26,7 @@ import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.session.ExpiringSession;
+import org.springframework.session.Session;
import org.springframework.session.SessionRepository;
import org.springframework.session.web.http.SessionRepositoryFilter;
import org.springframework.test.context.ContextConfiguration;
@@ -48,7 +48,7 @@ import static org.springframework.security.test.web.servlet.setup.SecurityMockMv
@ContextConfiguration(classes = RememberMeSecurityConfiguration.class)
@WebAppConfiguration
@SuppressWarnings("rawtypes")
-public class RememberMeSecurityConfigurationTests {
+public class RememberMeSecurityConfigurationTests {
@Autowired
WebApplicationContext context;
@Autowired
diff --git a/docs/src/test/java/docs/security/RememberMeSecurityConfigurationXmlTests.java b/docs/src/test/java/docs/security/RememberMeSecurityConfigurationXmlTests.java
index 982bf05e..62bbc78a 100644
--- a/docs/src/test/java/docs/security/RememberMeSecurityConfigurationXmlTests.java
+++ b/docs/src/test/java/docs/security/RememberMeSecurityConfigurationXmlTests.java
@@ -26,7 +26,7 @@ import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.session.ExpiringSession;
+import org.springframework.session.Session;
import org.springframework.session.SessionRepository;
import org.springframework.session.web.http.SessionRepositoryFilter;
import org.springframework.test.context.ContextConfiguration;
@@ -48,7 +48,7 @@ import static org.springframework.security.test.web.servlet.setup.SecurityMockMv
@ContextConfiguration
@WebAppConfiguration
@SuppressWarnings("rawtypes")
-public class RememberMeSecurityConfigurationXmlTests {
+public class RememberMeSecurityConfigurationXmlTests {
@Autowired
WebApplicationContext context;
@Autowired
diff --git a/docs/src/test/java/docs/security/SecurityConfiguration.java b/docs/src/test/java/docs/security/SecurityConfiguration.java
index 9548b37f..bb9e364e 100644
--- a/docs/src/test/java/docs/security/SecurityConfiguration.java
+++ b/docs/src/test/java/docs/security/SecurityConfiguration.java
@@ -21,8 +21,8 @@ import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
-import org.springframework.session.ExpiringSession;
import org.springframework.session.FindByIndexNameSessionRepository;
+import org.springframework.session.Session;
import org.springframework.session.security.SpringSessionBackedSessionRegistry;
/**
@@ -33,7 +33,7 @@ import org.springframework.session.security.SpringSessionBackedSessionRegistry;
public class SecurityConfiguration extends WebSecurityConfigurerAdapter {
@Autowired
- private FindByIndexNameSessionRepository sessionRepository;
+ private FindByIndexNameSessionRepository sessionRepository;
@Override
protected void configure(HttpSecurity http) throws Exception {
diff --git a/samples/boot/findbyusername/src/main/java/sample/mvc/IndexController.java b/samples/boot/findbyusername/src/main/java/sample/mvc/IndexController.java
index 9327f3d4..ce15b9f1 100644
--- a/samples/boot/findbyusername/src/main/java/sample/mvc/IndexController.java
+++ b/samples/boot/findbyusername/src/main/java/sample/mvc/IndexController.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2014-2016 the original author or authors.
+ * Copyright 2014-2017 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -21,8 +21,8 @@ import java.util.Collection;
import java.util.Set;
import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.session.ExpiringSession;
import org.springframework.session.FindByIndexNameSessionRepository;
+import org.springframework.session.Session;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.PathVariable;
@@ -39,11 +39,11 @@ import org.springframework.web.bind.annotation.RequestMethod;
public class IndexController {
// tag::findbyusername[]
@Autowired
- FindByIndexNameSessionRepository extends ExpiringSession> sessions;
+ FindByIndexNameSessionRepository extends Session> sessions;
@RequestMapping("/")
public String index(Principal principal, Model model) {
- Collection extends ExpiringSession> usersSessions = this.sessions
+ Collection extends Session> usersSessions = this.sessions
.findByIndexNameAndIndexValue(
FindByIndexNameSessionRepository.PRINCIPAL_NAME_INDEX_NAME,
principal.getName())
diff --git a/samples/boot/websocket/src/main/java/sample/config/WebSocketConfig.java b/samples/boot/websocket/src/main/java/sample/config/WebSocketConfig.java
index 8a28a553..abd602ef 100644
--- a/samples/boot/websocket/src/main/java/sample/config/WebSocketConfig.java
+++ b/samples/boot/websocket/src/main/java/sample/config/WebSocketConfig.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2014-2016 the original author or authors.
+ * Copyright 2014-2017 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -19,7 +19,7 @@ package sample.config;
import org.springframework.context.annotation.Configuration;
import org.springframework.messaging.simp.config.MessageBrokerRegistry;
import org.springframework.scheduling.annotation.EnableScheduling;
-import org.springframework.session.ExpiringSession;
+import org.springframework.session.Session;
import org.springframework.session.web.socket.config.annotation.AbstractSessionWebSocketMessageBrokerConfigurer;
import org.springframework.web.socket.config.annotation.EnableWebSocketMessageBroker;
import org.springframework.web.socket.config.annotation.StompEndpointRegistry;
@@ -29,7 +29,7 @@ import org.springframework.web.socket.config.annotation.StompEndpointRegistry;
@EnableScheduling
@EnableWebSocketMessageBroker
public class WebSocketConfig
- extends AbstractSessionWebSocketMessageBrokerConfigurer { // <1>
+ extends AbstractSessionWebSocketMessageBrokerConfigurer { // <1>
protected void configureStompEndpoints(StompEndpointRegistry registry) { // <2>
registry.addEndpoint("/messages").withSockJS();
diff --git a/samples/boot/websocket/src/main/java/sample/config/WebSocketHandlersConfig.java b/samples/boot/websocket/src/main/java/sample/config/WebSocketHandlersConfig.java
index 6e0eeafe..bc59fe7d 100644
--- a/samples/boot/websocket/src/main/java/sample/config/WebSocketHandlersConfig.java
+++ b/samples/boot/websocket/src/main/java/sample/config/WebSocketHandlersConfig.java
@@ -23,7 +23,7 @@ import sample.websocket.WebSocketDisconnectHandler;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.messaging.simp.SimpMessageSendingOperations;
-import org.springframework.session.ExpiringSession;
+import org.springframework.session.Session;
/**
* These handlers are separated from WebSocketConfig because they are specific to this
@@ -32,7 +32,7 @@ import org.springframework.session.ExpiringSession;
* @author Rob Winch
*/
@Configuration
-public class WebSocketHandlersConfig {
+public class WebSocketHandlersConfig {
@Bean
public WebSocketConnectHandler webSocketConnectHandler(
diff --git a/samples/javaconfig/rest/src/integration-test/java/rest/RestMockMvcTests.java b/samples/javaconfig/rest/src/integration-test/java/rest/RestMockMvcTests.java
index ec9e1a19..5d6d7691 100644
--- a/samples/javaconfig/rest/src/integration-test/java/rest/RestMockMvcTests.java
+++ b/samples/javaconfig/rest/src/integration-test/java/rest/RestMockMvcTests.java
@@ -26,7 +26,7 @@ import sample.mvc.MvcConfig;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.test.context.support.WithMockUser;
-import org.springframework.session.ExpiringSession;
+import org.springframework.session.Session;
import org.springframework.session.web.http.SessionRepositoryFilter;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
@@ -50,7 +50,7 @@ import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.
public class RestMockMvcTests {
@Autowired
- SessionRepositoryFilter extends ExpiringSession> sessionRepositoryFilter;
+ SessionRepositoryFilter extends Session> sessionRepositoryFilter;
@Autowired
WebApplicationContext context;
diff --git a/samples/misc/hazelcast/src/main/java/sample/Initializer.java b/samples/misc/hazelcast/src/main/java/sample/Initializer.java
index d52d813a..e117eb39 100644
--- a/samples/misc/hazelcast/src/main/java/sample/Initializer.java
+++ b/samples/misc/hazelcast/src/main/java/sample/Initializer.java
@@ -35,9 +35,9 @@ import com.hazelcast.config.SerializerConfig;
import com.hazelcast.core.Hazelcast;
import com.hazelcast.core.HazelcastInstance;
-import org.springframework.session.ExpiringSession;
import org.springframework.session.MapSession;
import org.springframework.session.MapSessionRepository;
+import org.springframework.session.Session;
import org.springframework.session.SessionRepository;
import org.springframework.session.web.http.SessionRepositoryFilter;
@@ -62,11 +62,10 @@ public class Initializer implements ServletContextListener {
cfg.addMapConfig(mc);
this.instance = Hazelcast.newHazelcastInstance(cfg);
- Map sessions = this.instance.getMap(sessionMapName);
+ Map sessions = this.instance.getMap(sessionMapName);
- SessionRepository sessionRepository = new MapSessionRepository(
- sessions);
- SessionRepositoryFilter filter = new SessionRepositoryFilter<>(
+ SessionRepository sessionRepository = new MapSessionRepository(sessions);
+ SessionRepositoryFilter filter = new SessionRepositoryFilter<>(
sessionRepository);
Dynamic fr = sc.addFilter("springSessionFilter", filter);
fr.addMappingForUrlPatterns(EnumSet.of(DispatcherType.REQUEST), true, "/*");
diff --git a/spring-session/src/integration-test/java/org/springframework/session/data/redis/config/annotation/web/http/EnableRedisHttpSessionExpireSessionDestroyedTests.java b/spring-session/src/integration-test/java/org/springframework/session/data/redis/config/annotation/web/http/EnableRedisHttpSessionExpireSessionDestroyedTests.java
index 2c14037f..c57b7c9a 100644
--- a/spring-session/src/integration-test/java/org/springframework/session/data/redis/config/annotation/web/http/EnableRedisHttpSessionExpireSessionDestroyedTests.java
+++ b/spring-session/src/integration-test/java/org/springframework/session/data/redis/config/annotation/web/http/EnableRedisHttpSessionExpireSessionDestroyedTests.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2014-2016 the original author or authors.
+ * Copyright 2014-2017 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -32,7 +32,7 @@ import org.springframework.security.core.Authentication;
import org.springframework.security.core.authority.AuthorityUtils;
import org.springframework.security.core.context.SecurityContext;
import org.springframework.security.core.context.SecurityContextHolder;
-import org.springframework.session.ExpiringSession;
+import org.springframework.session.Session;
import org.springframework.session.SessionRepository;
import org.springframework.session.events.SessionExpiredEvent;
import org.springframework.test.context.ContextConfiguration;
@@ -44,7 +44,7 @@ import static org.assertj.core.api.Assertions.assertThat;
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration
@WebAppConfiguration
-public class EnableRedisHttpSessionExpireSessionDestroyedTests {
+public class EnableRedisHttpSessionExpireSessionDestroyedTests {
@Autowired
private SessionRepository repository;
diff --git a/spring-session/src/integration-test/java/org/springframework/session/data/redis/flushimmediately/RedisOperationsSessionRepositoryFlushImmediatelyITests.java b/spring-session/src/integration-test/java/org/springframework/session/data/redis/flushimmediately/RedisOperationsSessionRepositoryFlushImmediatelyITests.java
index 5cd77056..4a87e0cf 100644
--- a/spring-session/src/integration-test/java/org/springframework/session/data/redis/flushimmediately/RedisOperationsSessionRepositoryFlushImmediatelyITests.java
+++ b/spring-session/src/integration-test/java/org/springframework/session/data/redis/flushimmediately/RedisOperationsSessionRepositoryFlushImmediatelyITests.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2014-2016 the original author or authors.
+ * Copyright 2014-2017 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -20,7 +20,7 @@ import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.session.ExpiringSession;
+import org.springframework.session.Session;
import org.springframework.session.SessionRepository;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
@@ -31,7 +31,7 @@ import static org.assertj.core.api.Assertions.assertThat;
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(classes = RedisHttpSessionConfig.class)
@WebAppConfiguration
-public class RedisOperationsSessionRepositoryFlushImmediatelyITests {
+public class RedisOperationsSessionRepositoryFlushImmediatelyITests {
@Autowired
private SessionRepository sessionRepository;
diff --git a/spring-session/src/integration-test/java/org/springframework/session/hazelcast/config/annotation/web/http/EnableHazelcastHttpSessionEventsTests.java b/spring-session/src/integration-test/java/org/springframework/session/hazelcast/config/annotation/web/http/EnableHazelcastHttpSessionEventsTests.java
index d42e43b6..f0dcf1d8 100644
--- a/spring-session/src/integration-test/java/org/springframework/session/hazelcast/config/annotation/web/http/EnableHazelcastHttpSessionEventsTests.java
+++ b/spring-session/src/integration-test/java/org/springframework/session/hazelcast/config/annotation/web/http/EnableHazelcastHttpSessionEventsTests.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2014-2016 the original author or authors.
+ * Copyright 2014-2017 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -29,7 +29,6 @@ import org.springframework.security.core.Authentication;
import org.springframework.security.core.authority.AuthorityUtils;
import org.springframework.security.core.context.SecurityContext;
import org.springframework.security.core.context.SecurityContextHolder;
-import org.springframework.session.ExpiringSession;
import org.springframework.session.FindByIndexNameSessionRepository;
import org.springframework.session.Session;
import org.springframework.session.SessionRepository;
@@ -54,7 +53,7 @@ import static org.assertj.core.api.Assertions.assertThat;
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration
@WebAppConfiguration
-public class EnableHazelcastHttpSessionEventsTests {
+public class EnableHazelcastHttpSessionEventsTests {
private final static int MAX_INACTIVE_INTERVAL_IN_SECONDS = 1;
@@ -119,7 +118,7 @@ public class EnableHazelcastHttpSessionEventsTests {
assertThat(this.registry.getEvent(sessionToSave.getId()))
.isInstanceOf(SessionExpiredEvent.class);
- assertThat(this.repository.getSession(sessionToSave.getId())).isNull();
+ assertThat(this.repository.getSession(sessionToSave.getId())).isNull();
}
@Test
diff --git a/spring-session/src/integration-test/java/org/springframework/session/hazelcast/config/annotation/web/http/HazelcastHttpSessionConfigurationXmlTests.java b/spring-session/src/integration-test/java/org/springframework/session/hazelcast/config/annotation/web/http/HazelcastHttpSessionConfigurationXmlTests.java
index e128b30a..7719b75c 100644
--- a/spring-session/src/integration-test/java/org/springframework/session/hazelcast/config/annotation/web/http/HazelcastHttpSessionConfigurationXmlTests.java
+++ b/spring-session/src/integration-test/java/org/springframework/session/hazelcast/config/annotation/web/http/HazelcastHttpSessionConfigurationXmlTests.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2014-2016 the original author or authors.
+ * Copyright 2014-2017 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -27,7 +27,7 @@ import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
-import org.springframework.session.ExpiringSession;
+import org.springframework.session.Session;
import org.springframework.session.SessionRepository;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
@@ -42,12 +42,12 @@ import static org.assertj.core.api.Assertions.assertThat;
*
* @author Tommy Ludwig
*/
-public class HazelcastHttpSessionConfigurationXmlTests {
+public class HazelcastHttpSessionConfigurationXmlTests {
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration
@WebAppConfiguration
- public static class CustomXmlMapNameTest {
+ public static class CustomXmlMapNameTest {
@Autowired
private SessionRepository repository;
@@ -84,7 +84,7 @@ public class HazelcastHttpSessionConfigurationXmlTests {
+ public static class CustomXmlMapNameAndIdleTest {
@Autowired
private SessionRepository repository;
diff --git a/spring-session/src/integration-test/java/org/springframework/session/jdbc/AbstractJdbcOperationsSessionRepositoryITests.java b/spring-session/src/integration-test/java/org/springframework/session/jdbc/AbstractJdbcOperationsSessionRepositoryITests.java
index c049e80b..fe66d03c 100644
--- a/spring-session/src/integration-test/java/org/springframework/session/jdbc/AbstractJdbcOperationsSessionRepositoryITests.java
+++ b/spring-session/src/integration-test/java/org/springframework/session/jdbc/AbstractJdbcOperationsSessionRepositoryITests.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2014-2016 the original author or authors.
+ * Copyright 2014-2017 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -34,7 +34,6 @@ import org.springframework.security.core.Authentication;
import org.springframework.security.core.authority.AuthorityUtils;
import org.springframework.security.core.context.SecurityContext;
import org.springframework.security.core.context.SecurityContextHolder;
-import org.springframework.session.ExpiringSession;
import org.springframework.session.FindByIndexNameSessionRepository;
import org.springframework.session.MapSession;
import org.springframework.session.Session;
@@ -156,7 +155,7 @@ public abstract class AbstractJdbcOperationsSessionRepositoryITests {
toSave.setLastAccessedTime(lastAccessedTime);
this.repository.save(toSave);
- ExpiringSession session = this.repository.getSession(toSave.getId());
+ Session session = this.repository.getSession(toSave.getId());
assertThat(session).isNotNull();
assertThat(session.isExpired()).isFalse();
diff --git a/spring-session/src/main/java/org/springframework/session/ExpiringSession.java b/spring-session/src/main/java/org/springframework/session/ExpiringSession.java
deleted file mode 100644
index ff408ed4..00000000
--- a/spring-session/src/main/java/org/springframework/session/ExpiringSession.java
+++ /dev/null
@@ -1,80 +0,0 @@
-/*
- * Copyright 2014-2016 the original author or authors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.springframework.session;
-
-/**
- * A {@link Session} that contains additional attributes that are useful for determining
- * if a session is expired.
- *
- * @author Rob Winch
- * @since 1.0
- */
-public interface ExpiringSession extends Session {
-
- /**
- * Gets the time when this session was created in milliseconds since midnight of
- * 1/1/1970 GMT.
- *
- * @return the time when this session was created in milliseconds since midnight of
- * 1/1/1970 GMT.
- */
- long getCreationTime();
-
- /**
- * Sets the last accessed time in milliseconds since midnight of 1/1/1970 GMT.
- *
- * @param lastAccessedTime the last accessed time in milliseconds since midnight of
- * 1/1/1970 GMT
- */
- void setLastAccessedTime(long lastAccessedTime);
-
- /**
- * Gets the last time this {@link Session} was accessed expressed in milliseconds
- * since midnight of 1/1/1970 GMT.
- *
- * @return the last time the client sent a request associated with the session
- * expressed in milliseconds since midnight of 1/1/1970 GMT
- */
- long getLastAccessedTime();
-
- /**
- * Sets the maximum inactive interval in seconds between requests before this session
- * will be invalidated. A negative time indicates that the session will never timeout.
- *
- * @param interval the number of seconds that the {@link Session} should be kept alive
- * between client requests.
- */
- void setMaxInactiveIntervalInSeconds(int interval);
-
- /**
- * Gets the maximum inactive interval in seconds between requests before this session
- * will be invalidated. A negative time indicates that the session will never timeout.
- *
- * @return the maximum inactive interval in seconds between requests before this
- * session will be invalidated. A negative time indicates that the session will never
- * timeout.
- */
- int getMaxInactiveIntervalInSeconds();
-
- /**
- * Returns true if the session is expired.
- *
- * @return true if the session is expired, else false.
- */
- boolean isExpired();
-
-}
diff --git a/spring-session/src/main/java/org/springframework/session/MapSession.java b/spring-session/src/main/java/org/springframework/session/MapSession.java
index 16278b0d..77008f0a 100644
--- a/spring-session/src/main/java/org/springframework/session/MapSession.java
+++ b/spring-session/src/main/java/org/springframework/session/MapSession.java
@@ -43,7 +43,7 @@ import java.util.concurrent.TimeUnit;
* @author Rob Winch
* @since 1.0
*/
-public final class MapSession implements ExpiringSession, Serializable {
+public final class MapSession implements Session, Serializable {
/**
* Default {@link #setMaxInactiveIntervalInSeconds(int)} (30 minutes).
*/
@@ -83,7 +83,7 @@ public final class MapSession implements ExpiringSession, Serializable {
* @param session the {@link Session} to initialize this {@link Session} with. Cannot
* be null.
*/
- public MapSession(ExpiringSession session) {
+ public MapSession(Session session) {
if (session == null) {
throw new IllegalArgumentException("session cannot be null");
}
diff --git a/spring-session/src/main/java/org/springframework/session/MapSessionRepository.java b/spring-session/src/main/java/org/springframework/session/MapSessionRepository.java
index 3dfa3367..67243a56 100644
--- a/spring-session/src/main/java/org/springframework/session/MapSessionRepository.java
+++ b/spring-session/src/main/java/org/springframework/session/MapSessionRepository.java
@@ -36,14 +36,14 @@ import org.springframework.session.events.SessionExpiredEvent;
* @author Rob Winch
* @since 1.0
*/
-public class MapSessionRepository implements SessionRepository {
+public class MapSessionRepository implements SessionRepository {
/**
* If non-null, this value is used to override
- * {@link ExpiringSession#setMaxInactiveIntervalInSeconds(int)}.
+ * {@link Session#setMaxInactiveIntervalInSeconds(int)}.
*/
private Integer defaultMaxInactiveInterval;
- private final Map sessions;
+ private final Map sessions;
/**
* Creates an instance backed by a {@link java.util.concurrent.ConcurrentHashMap}.
@@ -58,7 +58,7 @@ public class MapSessionRepository implements SessionRepository
*
* @param sessions the {@link java.util.Map} to use. Cannot be null.
*/
- public MapSessionRepository(Map sessions) {
+ public MapSessionRepository(Map sessions) {
if (sessions == null) {
throw new IllegalArgumentException("sessions cannot be null");
}
@@ -67,7 +67,7 @@ public class MapSessionRepository implements SessionRepository
/**
* If non-null, this value is used to override
- * {@link ExpiringSession#setMaxInactiveIntervalInSeconds(int)}.
+ * {@link Session#setMaxInactiveIntervalInSeconds(int)}.
* @param defaultMaxInactiveInterval the number of seconds that the {@link Session}
* should be kept alive between client requests.
*/
@@ -75,12 +75,12 @@ public class MapSessionRepository implements SessionRepository
this.defaultMaxInactiveInterval = Integer.valueOf(defaultMaxInactiveInterval);
}
- public void save(ExpiringSession session) {
+ public void save(Session session) {
this.sessions.put(session.getId(), new MapSession(session));
}
- public ExpiringSession getSession(String id) {
- ExpiringSession saved = this.sessions.get(id);
+ public Session getSession(String id) {
+ Session saved = this.sessions.get(id);
if (saved == null) {
return null;
}
@@ -95,8 +95,8 @@ public class MapSessionRepository implements SessionRepository
this.sessions.remove(id);
}
- public ExpiringSession createSession() {
- ExpiringSession result = new MapSession();
+ public Session createSession() {
+ Session result = new MapSession();
if (this.defaultMaxInactiveInterval != null) {
result.setMaxInactiveIntervalInSeconds(this.defaultMaxInactiveInterval);
}
diff --git a/spring-session/src/main/java/org/springframework/session/Session.java b/spring-session/src/main/java/org/springframework/session/Session.java
index 0ab3f7af..34d45c88 100644
--- a/spring-session/src/main/java/org/springframework/session/Session.java
+++ b/spring-session/src/main/java/org/springframework/session/Session.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2014-2016 the original author or authors.
+ * Copyright 2014-2017 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -71,4 +71,57 @@ public interface Session {
* @param attributeName the name of the attribute to remove
*/
void removeAttribute(String attributeName);
+
+ /**
+ * Gets the time when this session was created in milliseconds since midnight of
+ * 1/1/1970 GMT.
+ *
+ * @return the time when this session was created in milliseconds since midnight of
+ * 1/1/1970 GMT.
+ */
+ long getCreationTime();
+
+ /**
+ * Sets the last accessed time in milliseconds since midnight of 1/1/1970 GMT.
+ *
+ * @param lastAccessedTime the last accessed time in milliseconds since midnight of
+ * 1/1/1970 GMT
+ */
+ void setLastAccessedTime(long lastAccessedTime);
+
+ /**
+ * Gets the last time this {@link Session} was accessed expressed in milliseconds
+ * since midnight of 1/1/1970 GMT.
+ *
+ * @return the last time the client sent a request associated with the session
+ * expressed in milliseconds since midnight of 1/1/1970 GMT
+ */
+ long getLastAccessedTime();
+
+ /**
+ * Sets the maximum inactive interval in seconds between requests before this session
+ * will be invalidated. A negative time indicates that the session will never timeout.
+ *
+ * @param interval the number of seconds that the {@link Session} should be kept alive
+ * between client requests.
+ */
+ void setMaxInactiveIntervalInSeconds(int interval);
+
+ /**
+ * Gets the maximum inactive interval in seconds between requests before this session
+ * will be invalidated. A negative time indicates that the session will never timeout.
+ *
+ * @return the maximum inactive interval in seconds between requests before this
+ * session will be invalidated. A negative time indicates that the session will never
+ * timeout.
+ */
+ int getMaxInactiveIntervalInSeconds();
+
+ /**
+ * Returns true if the session is expired.
+ *
+ * @return true if the session is expired, else false.
+ */
+ boolean isExpired();
+
}
diff --git a/spring-session/src/main/java/org/springframework/session/config/annotation/web/http/SpringHttpSessionConfiguration.java b/spring-session/src/main/java/org/springframework/session/config/annotation/web/http/SpringHttpSessionConfiguration.java
index 388cb071..65df4784 100644
--- a/spring-session/src/main/java/org/springframework/session/config/annotation/web/http/SpringHttpSessionConfiguration.java
+++ b/spring-session/src/main/java/org/springframework/session/config/annotation/web/http/SpringHttpSessionConfiguration.java
@@ -33,7 +33,7 @@ import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
-import org.springframework.session.ExpiringSession;
+import org.springframework.session.Session;
import org.springframework.session.SessionRepository;
import org.springframework.session.events.SessionCreatedEvent;
import org.springframework.session.events.SessionDestroyedEvent;
@@ -122,7 +122,7 @@ public class SpringHttpSessionConfiguration implements ApplicationContextAware {
}
@Bean
- public SessionRepositoryFilter extends ExpiringSession> springSessionRepositoryFilter(
+ public SessionRepositoryFilter extends Session> springSessionRepositoryFilter(
SessionRepository sessionRepository) {
SessionRepositoryFilter sessionRepositoryFilter = new SessionRepositoryFilter<>(
sessionRepository);
diff --git a/spring-session/src/main/java/org/springframework/session/data/redis/RedisOperationsSessionRepository.java b/spring-session/src/main/java/org/springframework/session/data/redis/RedisOperationsSessionRepository.java
index 9777fc03..2440bcb8 100644
--- a/spring-session/src/main/java/org/springframework/session/data/redis/RedisOperationsSessionRepository.java
+++ b/spring-session/src/main/java/org/springframework/session/data/redis/RedisOperationsSessionRepository.java
@@ -39,7 +39,6 @@ import org.springframework.data.redis.serializer.StringRedisSerializer;
import org.springframework.expression.Expression;
import org.springframework.expression.spel.standard.SpelExpressionParser;
import org.springframework.scheduling.annotation.Scheduled;
-import org.springframework.session.ExpiringSession;
import org.springframework.session.FindByIndexNameSessionRepository;
import org.springframework.session.MapSession;
import org.springframework.session.Session;
@@ -259,20 +258,20 @@ public class RedisOperationsSessionRepository implements
/**
* The key in the Hash representing
- * {@link org.springframework.session.ExpiringSession#getCreationTime()}.
+ * {@link org.springframework.session.Session#getCreationTime()}.
*/
static final String CREATION_TIME_ATTR = "creationTime";
/**
* The key in the Hash representing
- * {@link org.springframework.session.ExpiringSession#getMaxInactiveIntervalInSeconds()}
+ * {@link org.springframework.session.Session#getMaxInactiveIntervalInSeconds()}
* .
*/
static final String MAX_INACTIVE_ATTR = "maxInactiveInterval";
/**
* The key in the Hash representing
- * {@link org.springframework.session.ExpiringSession#getLastAccessedTime()}.
+ * {@link org.springframework.session.Session#getLastAccessedTime()}.
*/
static final String LAST_ACCESSED_ATTR = "lastAccessedTime";
@@ -549,7 +548,7 @@ public class RedisOperationsSessionRepository implements
public void handleCreated(Map
*
- * @param the {@link ExpiringSession} type
+ * @param the {@link Session} type
* @author Rob Winch
* @since 1.0
*/
-public final class SessionRepositoryMessageInterceptor
+public final class SessionRepositoryMessageInterceptor
extends ChannelInterceptorAdapter implements HandshakeInterceptor {
private static final String SPRING_SESSION_ID_ATTR_NAME = "SPRING.SESSION.ID";
@@ -88,7 +87,7 @@ public final class SessionRepositoryMessageInterceptor
* Sets the {@link SimpMessageType} to match on. If the {@link Message} matches, then
* {@link #preSend(Message, MessageChannel)} ensures the {@link Session} is not
- * expired and updates the {@link ExpiringSession#getLastAccessedTime()}
+ * expired and updates the {@link Session#getLastAccessedTime()}
*
*
*
diff --git a/spring-session/src/test/java/org/springframework/session/MapSessionRepositoryTests.java b/spring-session/src/test/java/org/springframework/session/MapSessionRepositoryTests.java
index 0c3bffdd..c9ffff91 100644
--- a/spring-session/src/test/java/org/springframework/session/MapSessionRepositoryTests.java
+++ b/spring-session/src/test/java/org/springframework/session/MapSessionRepositoryTests.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2014-2016 the original author or authors.
+ * Copyright 2014-2017 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -46,7 +46,7 @@ public class MapSessionRepositoryTests {
@Test
public void createSessionDefaultExpiration() {
- ExpiringSession session = this.repository.createSession();
+ Session session = this.repository.createSession();
assertThat(session).isInstanceOf(MapSession.class);
assertThat(session.getMaxInactiveIntervalInSeconds())
@@ -59,7 +59,7 @@ public class MapSessionRepositoryTests {
+ 10;
this.repository.setDefaultMaxInactiveInterval(expectedMaxInterval);
- ExpiringSession session = this.repository.createSession();
+ Session session = this.repository.createSession();
assertThat(session.getMaxInactiveIntervalInSeconds())
.isEqualTo(expectedMaxInterval);
diff --git a/spring-session/src/test/java/org/springframework/session/MapSessionTests.java b/spring-session/src/test/java/org/springframework/session/MapSessionTests.java
index 3088495a..361d22f2 100644
--- a/spring-session/src/test/java/org/springframework/session/MapSessionTests.java
+++ b/spring-session/src/test/java/org/springframework/session/MapSessionTests.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2014-2016 the original author or authors.
+ * Copyright 2014-2017 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -35,7 +35,7 @@ public class MapSessionTests {
@Test(expected = IllegalArgumentException.class)
public void constructorNullSession() {
- new MapSession((ExpiringSession) null);
+ new MapSession((Session) null);
}
/**
@@ -85,7 +85,7 @@ public class MapSessionTests {
assertThat(this.session.isExpired(now)).isTrue();
}
- static class CustomSession implements ExpiringSession {
+ static class CustomSession implements Session {
public long getCreationTime() {
return 0;
diff --git a/spring-session/src/test/java/org/springframework/session/config/annotation/web/http/EnableSpringHttpSessionCustomCookieSerializerTests.java b/spring-session/src/test/java/org/springframework/session/config/annotation/web/http/EnableSpringHttpSessionCustomCookieSerializerTests.java
index d69ae9c4..1abbdb54 100644
--- a/spring-session/src/test/java/org/springframework/session/config/annotation/web/http/EnableSpringHttpSessionCustomCookieSerializerTests.java
+++ b/spring-session/src/test/java/org/springframework/session/config/annotation/web/http/EnableSpringHttpSessionCustomCookieSerializerTests.java
@@ -34,8 +34,8 @@ import org.springframework.context.annotation.Configuration;
import org.springframework.mock.web.MockFilterChain;
import org.springframework.mock.web.MockHttpServletRequest;
import org.springframework.mock.web.MockHttpServletResponse;
-import org.springframework.session.ExpiringSession;
import org.springframework.session.MapSessionRepository;
+import org.springframework.session.Session;
import org.springframework.session.web.http.CookieSerializer;
import org.springframework.session.web.http.CookieSerializer.CookieValue;
import org.springframework.session.web.http.SessionRepositoryFilter;
@@ -65,7 +65,7 @@ public class EnableSpringHttpSessionCustomCookieSerializerTests {
MockFilterChain chain;
@Autowired
- SessionRepositoryFilter extends ExpiringSession> sessionRepositoryFilter;
+ SessionRepositoryFilter extends Session> sessionRepositoryFilter;
@Autowired
CookieSerializer cookieSerializer;
diff --git a/spring-session/src/test/java/org/springframework/session/config/annotation/web/http/EnableSpringHttpSessionCustomMultiHttpSessionStrategyTests.java b/spring-session/src/test/java/org/springframework/session/config/annotation/web/http/EnableSpringHttpSessionCustomMultiHttpSessionStrategyTests.java
index 32202748..2b582601 100644
--- a/spring-session/src/test/java/org/springframework/session/config/annotation/web/http/EnableSpringHttpSessionCustomMultiHttpSessionStrategyTests.java
+++ b/spring-session/src/test/java/org/springframework/session/config/annotation/web/http/EnableSpringHttpSessionCustomMultiHttpSessionStrategyTests.java
@@ -29,8 +29,8 @@ import org.springframework.context.annotation.Configuration;
import org.springframework.mock.web.MockFilterChain;
import org.springframework.mock.web.MockHttpServletRequest;
import org.springframework.mock.web.MockHttpServletResponse;
-import org.springframework.session.ExpiringSession;
import org.springframework.session.MapSessionRepository;
+import org.springframework.session.Session;
import org.springframework.session.web.http.MultiHttpSessionStrategy;
import org.springframework.session.web.http.SessionRepositoryFilter;
import org.springframework.test.context.ContextConfiguration;
@@ -58,7 +58,7 @@ public class EnableSpringHttpSessionCustomMultiHttpSessionStrategyTests {
MockFilterChain chain;
@Autowired
- SessionRepositoryFilter extends ExpiringSession> sessionRepositoryFilter;
+ SessionRepositoryFilter extends Session> sessionRepositoryFilter;
@Autowired
MultiHttpSessionStrategy strategy;
diff --git a/spring-session/src/test/java/org/springframework/session/data/redis/RedisOperationsSessionRepositoryTests.java b/spring-session/src/test/java/org/springframework/session/data/redis/RedisOperationsSessionRepositoryTests.java
index 7ce71ec3..141df6ca 100644
--- a/spring-session/src/test/java/org/springframework/session/data/redis/RedisOperationsSessionRepositoryTests.java
+++ b/spring-session/src/test/java/org/springframework/session/data/redis/RedisOperationsSessionRepositoryTests.java
@@ -47,9 +47,9 @@ import org.springframework.security.core.Authentication;
import org.springframework.security.core.authority.AuthorityUtils;
import org.springframework.security.core.context.SecurityContext;
import org.springframework.security.core.context.SecurityContextImpl;
-import org.springframework.session.ExpiringSession;
import org.springframework.session.FindByIndexNameSessionRepository;
import org.springframework.session.MapSession;
+import org.springframework.session.Session;
import org.springframework.session.data.redis.RedisOperationsSessionRepository.PrincipalNameResolver;
import org.springframework.session.data.redis.RedisOperationsSessionRepository.RedisSession;
import org.springframework.session.events.AbstractSessionEvent;
@@ -130,7 +130,7 @@ public class RedisOperationsSessionRepositoryTests {
@Test
public void createSessionDefaultMaxInactiveInterval() throws Exception {
- ExpiringSession session = this.redisRepository.createSession();
+ Session session = this.redisRepository.createSession();
assertThat(session.getMaxInactiveIntervalInSeconds())
.isEqualTo(new MapSession().getMaxInactiveIntervalInSeconds());
}
@@ -139,7 +139,7 @@ public class RedisOperationsSessionRepositoryTests {
public void createSessionCustomMaxInactiveInterval() throws Exception {
int interval = 1;
this.redisRepository.setDefaultMaxInactiveInterval(interval);
- ExpiringSession session = this.redisRepository.createSession();
+ Session session = this.redisRepository.createSession();
assertThat(session.getMaxInactiveIntervalInSeconds()).isEqualTo(interval);
}
diff --git a/spring-session/src/test/java/org/springframework/session/security/SpringSessionBackedSessionRegistryTest.java b/spring-session/src/test/java/org/springframework/session/security/SpringSessionBackedSessionRegistryTest.java
index aa846264..b2d51d1b 100644
--- a/spring-session/src/test/java/org/springframework/session/security/SpringSessionBackedSessionRegistryTest.java
+++ b/spring-session/src/test/java/org/springframework/session/security/SpringSessionBackedSessionRegistryTest.java
@@ -30,13 +30,12 @@ import org.mockito.Mock;
import org.mockito.junit.MockitoJUnitRunner;
import org.springframework.security.core.Authentication;
-import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.context.SecurityContextImpl;
import org.springframework.security.core.session.SessionInformation;
import org.springframework.security.core.userdetails.User;
-import org.springframework.session.ExpiringSession;
import org.springframework.session.FindByIndexNameSessionRepository;
import org.springframework.session.MapSession;
+import org.springframework.session.Session;
import static org.assertj.core.api.Assertions.assertThat;
import static org.mockito.BDDMockito.mock;
@@ -56,19 +55,19 @@ public class SpringSessionBackedSessionRegistryTest {
private static final String USER_NAME = "userName";
private static final User PRINCIPAL = new User(USER_NAME, "password",
- Collections.emptyList());
+ Collections.emptyList());
private static final Date NOW = new Date();
@Mock
- private FindByIndexNameSessionRepository sessionRepository;
+ private FindByIndexNameSessionRepository sessionRepository;
@InjectMocks
- private SpringSessionBackedSessionRegistry sessionRegistry;
+ private SpringSessionBackedSessionRegistry sessionRegistry;
@Test
public void sessionInformationForExistingSession() {
- ExpiringSession session = createSession(SESSION_ID, USER_NAME, NOW.getTime());
+ Session session = createSession(SESSION_ID, USER_NAME, NOW.getTime());
when(this.sessionRepository.getSession(SESSION_ID)).thenReturn(session);
SessionInformation sessionInfo = this.sessionRegistry
@@ -82,7 +81,7 @@ public class SpringSessionBackedSessionRegistryTest {
@Test
public void sessionInformationForExpiredSession() {
- ExpiringSession session = createSession(SESSION_ID, USER_NAME, NOW.getTime());
+ Session session = createSession(SESSION_ID, USER_NAME, NOW.getTime());
session.setAttribute(SpringSessionBackedSessionInformation.EXPIRED_ATTR,
Boolean.TRUE);
when(this.sessionRepository.getSession(SESSION_ID)).thenReturn(session);
@@ -126,7 +125,7 @@ public class SpringSessionBackedSessionRegistryTest {
@Test
public void expireNow() {
- ExpiringSession session = createSession(SESSION_ID, USER_NAME, NOW.getTime());
+ Session session = createSession(SESSION_ID, USER_NAME, NOW.getTime());
when(this.sessionRepository.getSession(SESSION_ID)).thenReturn(session);
SessionInformation sessionInfo = this.sessionRegistry
@@ -136,16 +135,14 @@ public class SpringSessionBackedSessionRegistryTest {
sessionInfo.expireNow();
assertThat(sessionInfo.isExpired()).isTrue();
- ArgumentCaptor captor = ArgumentCaptor
- .forClass(ExpiringSession.class);
+ ArgumentCaptor captor = ArgumentCaptor.forClass(Session.class);
verify(this.sessionRepository).save(captor.capture());
assertThat(captor.getValue().getAttribute(
SpringSessionBackedSessionInformation.EXPIRED_ATTR))
.isEqualTo(Boolean.TRUE);
}
- private ExpiringSession createSession(String sessionId, String userName,
- Long lastAccessed) {
+ private Session createSession(String sessionId, String userName, Long lastAccessed) {
MapSession session = new MapSession(sessionId);
session.setLastAccessedTime(lastAccessed);
Authentication authentication = mock(Authentication.class);
@@ -157,11 +154,11 @@ public class SpringSessionBackedSessionRegistryTest {
}
private void setUpSessions() {
- ExpiringSession session1 = createSession(SESSION_ID, USER_NAME, NOW.getTime());
+ Session session1 = createSession(SESSION_ID, USER_NAME, NOW.getTime());
session1.setAttribute(SpringSessionBackedSessionInformation.EXPIRED_ATTR,
Boolean.TRUE);
- ExpiringSession session2 = createSession(SESSION_ID2, USER_NAME, NOW.getTime());
- Map sessions = new LinkedHashMap<>();
+ Session session2 = createSession(SESSION_ID2, USER_NAME, NOW.getTime());
+ Map sessions = new LinkedHashMap<>();
sessions.put(session1.getId(), session1);
sessions.put(session2.getId(), session2);
when(this.sessionRepository.findByIndexNameAndIndexValue(
diff --git a/spring-session/src/test/java/org/springframework/session/web/http/SessionRepositoryFilterTests.java b/spring-session/src/test/java/org/springframework/session/web/http/SessionRepositoryFilterTests.java
index 06ffec4e..461cc82b 100644
--- a/spring-session/src/test/java/org/springframework/session/web/http/SessionRepositoryFilterTests.java
+++ b/spring-session/src/test/java/org/springframework/session/web/http/SessionRepositoryFilterTests.java
@@ -49,7 +49,6 @@ import org.springframework.mock.web.MockFilterChain;
import org.springframework.mock.web.MockHttpServletRequest;
import org.springframework.mock.web.MockHttpServletResponse;
import org.springframework.mock.web.MockServletContext;
-import org.springframework.session.ExpiringSession;
import org.springframework.session.MapSession;
import org.springframework.session.MapSessionRepository;
import org.springframework.session.Session;
@@ -74,11 +73,11 @@ public class SessionRepositoryFilterTests {
@Mock
private HttpSessionStrategy strategy;
- private Map sessions;
+ private Map sessions;
- private SessionRepository sessionRepository;
+ private SessionRepository sessionRepository;
- private SessionRepositoryFilter filter;
+ private SessionRepositoryFilter filter;
private MockHttpServletRequest request;
@@ -422,7 +421,7 @@ public class SessionRepositoryFilterTests {
public void doFilterSetsCookieIfChanged() throws Exception {
this.sessionRepository = new MapSessionRepository() {
@Override
- public ExpiringSession getSession(String id) {
+ public Session getSession(String id) {
return createSession();
}
};
@@ -1256,8 +1255,7 @@ public class SessionRepositoryFilterTests {
@SuppressWarnings("unchecked")
public void doFilterRequestSessionNoRequestSessionNoSessionRepositoryInteractions()
throws Exception {
- SessionRepository sessionRepository = spy(
- new MapSessionRepository());
+ SessionRepository sessionRepository = spy(new MapSessionRepository());
this.filter = new SessionRepositoryFilter<>(sessionRepository);
@@ -1284,8 +1282,7 @@ public class SessionRepositoryFilterTests {
@Test
public void doFilterLazySessionCreation() throws Exception {
- SessionRepository sessionRepository = spy(
- new MapSessionRepository());
+ SessionRepository sessionRepository = spy(new MapSessionRepository());
this.filter = new SessionRepositoryFilter<>(sessionRepository);
@@ -1301,10 +1298,9 @@ public class SessionRepositoryFilterTests {
@Test
public void doFilterLazySessionUpdates() throws Exception {
- ExpiringSession session = this.sessionRepository.createSession();
+ Session session = this.sessionRepository.createSession();
this.sessionRepository.save(session);
- SessionRepository sessionRepository = spy(
- this.sessionRepository);
+ SessionRepository sessionRepository = spy(this.sessionRepository);
setSessionCookie(session.getId());
this.filter = new SessionRepositoryFilter<>(sessionRepository);
diff --git a/spring-session/src/test/java/org/springframework/session/web/socket/server/SessionRepositoryMessageInterceptorTests.java b/spring-session/src/test/java/org/springframework/session/web/socket/server/SessionRepositoryMessageInterceptorTests.java
index 068df07b..cdf6ff64 100644
--- a/spring-session/src/test/java/org/springframework/session/web/socket/server/SessionRepositoryMessageInterceptorTests.java
+++ b/spring-session/src/test/java/org/springframework/session/web/socket/server/SessionRepositoryMessageInterceptorTests.java
@@ -38,7 +38,7 @@ import org.springframework.messaging.simp.SimpMessageHeaderAccessor;
import org.springframework.messaging.simp.SimpMessageType;
import org.springframework.messaging.support.MessageBuilder;
import org.springframework.mock.web.MockHttpServletRequest;
-import org.springframework.session.ExpiringSession;
+import org.springframework.session.Session;
import org.springframework.session.SessionRepository;
import static org.assertj.core.api.Assertions.assertThat;
@@ -53,17 +53,17 @@ import static org.mockito.Mockito.verifyZeroInteractions;
@RunWith(MockitoJUnitRunner.class)
public class SessionRepositoryMessageInterceptorTests {
@Mock
- SessionRepository sessionRepository;
+ SessionRepository sessionRepository;
@Mock
MessageChannel channel;
@Mock
- ExpiringSession session;
+ Session session;
Message> createMessage;
SimpMessageHeaderAccessor headers;
- SessionRepositoryMessageInterceptor interceptor;
+ SessionRepositoryMessageInterceptor interceptor;
@Before
public void setup() {
@@ -202,7 +202,7 @@ public class SessionRepositoryMessageInterceptorTests {
this.interceptor.preSend(createMessage(), this.channel);
- verify(this.sessionRepository, times(0)).save(any(ExpiringSession.class));
+ verify(this.sessionRepository, times(0)).save(any(Session.class));
}
@Test