Open
Description
Source:
Bug
The following code will always execute, Regardless of whether maxInactiveInterval
is less than 0
RedisIndexedSessionRepository.this.sessionRedisOperations.boundHashOps(getSessionKey(getId()))
.expire(fiveMinutesAfterExpires, TimeUnit.SECONDS);
This code in createShadowKey
will always be skipped:
if (sessionExpireInSeconds < 0) {
...
RedisIndexedSessionRepository.this.sessionRedisOperations.boundHashOps(getSessionKey(getId()))
.persist();
}
How to fix
long sessionExpireInSeconds = getMaxInactiveInterval().getSeconds();
createShadowKey(sessionExpireInSeconds);
if (sessionExpireInSeconds > 0) {
long fiveMinutesAfterExpires = sessionExpireInSeconds + TimeUnit.MINUTES.toSeconds(5);
RedisIndexedSessionRepository.this.sessionRedisOperations.boundHashOps(getSessionKey(getId()))
.expire(fiveMinutesAfterExpires, TimeUnit.SECONDS);
}
RedisIndexedSessionRepository.this.expirationStore.save(this);
this.delta = new HashMap<>(this.delta.size());