use of org.springframework.session.MapSession in project metasfresh-webui-api by metasfresh.
the class FixedMapSessionRepository method createSession.
@Override
public ExpiringSession createSession() {
final ExpiringSession result = new MapSession();
if (defaultMaxInactiveInterval != null) {
result.setMaxInactiveIntervalInSeconds(defaultMaxInactiveInterval);
}
// Fire event
applicationEventPublisher.publishEvent(new SessionCreatedEvent(this, result.getId()));
return result;
}
use of org.springframework.session.MapSession in project metasfresh-webui-api by metasfresh.
the class FixedMapSessionRepository method getSession.
@Override
public ExpiringSession getSession(final String id) {
final ExpiringSession saved = sessions.get(id);
if (saved == null) {
return null;
}
if (saved.isExpired()) {
final boolean expired = true;
deleteAndFireEvent(saved.getId(), expired);
return null;
}
return new MapSession(saved);
}
use of org.springframework.session.MapSession in project spring-session by spring-projects.
the class AbstractHttpSessionListenerTests method springSessionDestroyedTranslatedToSpringSecurityDestroyed.
@Test
public void springSessionDestroyedTranslatedToSpringSecurityDestroyed() {
Session session = new MapSession();
this.publisher.publishEvent(new org.springframework.session.events.SessionDestroyedEvent(this, session));
assertThat(this.listener.getEvent().getId()).isEqualTo(session.getId());
}
use of org.springframework.session.MapSession in project spring-session by spring-projects.
the class RedisOperationsSessionRepositoryTests method saveExpired.
@Test
public void saveExpired() {
RedisSession session = this.redisRepository.new RedisSession(new MapSession());
session.setMaxInactiveInterval(Duration.ZERO);
given(this.redisOperations.boundHashOps(anyString())).willReturn(this.boundHashOperations);
given(this.redisOperations.boundSetOps(anyString())).willReturn(this.boundSetOperations);
this.redisRepository.save(session);
String id = session.getId();
verify(this.redisOperations, atLeastOnce()).delete(getKey("expires:" + id));
verify(this.redisOperations, never()).boundValueOps(getKey("expires:" + id));
}
use of org.springframework.session.MapSession in project spring-session by spring-projects.
the class RedisOperationsSessionRepositoryTests method saveLastAccessChanged.
@Test
public void saveLastAccessChanged() {
RedisSession session = this.redisRepository.new RedisSession(new MapSession(this.cached));
session.setLastAccessedTime(Instant.ofEpochMilli(12345678L));
given(this.redisOperations.boundHashOps(anyString())).willReturn(this.boundHashOperations);
given(this.redisOperations.boundSetOps(anyString())).willReturn(this.boundSetOperations);
given(this.redisOperations.boundValueOps(anyString())).willReturn(this.boundValueOperations);
this.redisRepository.save(session);
assertThat(getDelta()).isEqualTo(map(RedisOperationsSessionRepository.LAST_ACCESSED_ATTR, session.getLastAccessedTime().toEpochMilli()));
}
Aggregations