Add ExpiringSession setLastAccessedTime
Previously SessionRepository had to update the lastAccessTime when it was loaded. This prevented inspecting the last access time. For example, listing all the sessions for a specific user. Furthermore, it is unintuitive that a read operation would update attributes on the domain model. This change introduces ExpiringSession setLastAccessedTime to allow setting the expiration on the interface. This means that the SessionRepositoryFilter can update the last accessed time. Fixes gh-272
This commit is contained in:
@@ -94,6 +94,10 @@ public class MapSessionTests {
|
||||
return "id";
|
||||
}
|
||||
|
||||
public void setLastAccessedTime(long lastAccessedTime) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
public long getLastAccessedTime() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -319,7 +319,7 @@ public class RedisOperationsSessionRepositoryTests {
|
||||
assertThat(session.getAttribute(attrName)).isEqualTo(expected.getAttribute(attrName));
|
||||
assertThat(session.getCreationTime()).isEqualTo(expected.getCreationTime());
|
||||
assertThat(session.getMaxInactiveIntervalInSeconds()).isEqualTo(expected.getMaxInactiveIntervalInSeconds());
|
||||
assertThat(session.getLastAccessedTime()).isGreaterThanOrEqualTo(now);
|
||||
assertThat(session.getLastAccessedTime()).isEqualTo(expected.getLastAccessedTime());
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -126,7 +126,7 @@ public class SessionRepositoryFilterTests {
|
||||
}
|
||||
});
|
||||
|
||||
Thread.sleep(10L);
|
||||
Thread.sleep(1L);
|
||||
nextRequest();
|
||||
|
||||
doFilter(new DoInFilter() {
|
||||
|
||||
Reference in New Issue
Block a user