private Mono<Void> save(ServerWebExchange exchange, WebSession session) { List<String> ids = getSessionIdResolver().resolveSessionIds(exchange); if (!session.isStarted() || session.isExpired()) { if (!ids.isEmpty()) { // Expired on retrieve or while processing request, or invalidated.. this.sessionIdResolver.expireSession(exchange); } return Mono.empty(); } if (ids.isEmpty() || !session.getId().equals(ids.get(0))) { this.sessionIdResolver.setSessionId(exchange, session.getId()); } return session.save(); }
private Mono<WebSession> retrieveSession(ServerWebExchange exchange) { return Flux.fromIterable(getSessionIdResolver().resolveSessionIds(exchange)) .concatMap(this.sessionStore::retrieveSession) .next(); }
private Mono<Void> save(ServerWebExchange exchange, WebSession session) { List<String> ids = getSessionIdResolver().resolveSessionIds(exchange); if (!session.isStarted() || session.isExpired()) { if (!ids.isEmpty()) { // Expired on retrieve or while processing request, or invalidated.. this.sessionIdResolver.expireSession(exchange); } return Mono.empty(); } if (ids.isEmpty() || !session.getId().equals(ids.get(0))) { this.sessionIdResolver.setSessionId(exchange, session.getId()); } return session.save(); }
private Mono<WebSession> retrieveSession(ServerWebExchange exchange) { return Flux.fromIterable(getSessionIdResolver().resolveSessionIds(exchange)) .concatMap(this.sessionStore::retrieveSession) .next(); }
@Test public void providedSessionIdResolverShouldBePickedUpAutomatically() { this.context = new AnnotationConfigApplicationContext(); this.context.register(OverrideSessionIdResolver.class); this.context.refresh(); DefaultWebSessionManager manager = this.context.getBean(DefaultWebSessionManager.class); assertThat(manager.getSessionIdResolver().getClass()).isAssignableFrom(HeaderWebSessionIdResolver.class); }
@Test public void defaultSessionIdResolverShouldBeCookieBased() { this.context = new AnnotationConfigApplicationContext(); this.context.register(GoodConfig.class); this.context.refresh(); DefaultWebSessionManager manager = this.context.getBean(DefaultWebSessionManager.class); assertThat(manager.getSessionIdResolver().getClass()).isAssignableFrom(CookieWebSessionIdResolver.class); }
private Mono<Void> save(ServerWebExchange exchange, WebSession session) { List<String> ids = getSessionIdResolver().resolveSessionIds(exchange); if (!session.isStarted() || session.isExpired()) { if (!ids.isEmpty()) { // Expired on retrieve or while processing request, or invalidated.. this.sessionIdResolver.expireSession(exchange); } return Mono.empty(); } if (ids.isEmpty() || !session.getId().equals(ids.get(0))) { this.sessionIdResolver.setSessionId(exchange, session.getId()); } return session.save(); }
private Mono<Void> save(ServerWebExchange exchange, WebSession session) { List<String> ids = getSessionIdResolver().resolveSessionIds(exchange); if (!session.isStarted() || session.isExpired()) { if (!ids.isEmpty()) { // Expired on retrieve or while processing request, or invalidated.. this.sessionIdResolver.expireSession(exchange); } return Mono.empty(); } if (ids.isEmpty() || !session.getId().equals(ids.get(0))) { this.sessionIdResolver.setSessionId(exchange, session.getId()); } return session.save(); }
private Mono<WebSession> retrieveSession(ServerWebExchange exchange) { return Flux.fromIterable(getSessionIdResolver().resolveSessionIds(exchange)) .concatMap(this.sessionStore::retrieveSession) .next(); }
private Mono<WebSession> retrieveSession(ServerWebExchange exchange) { return Flux.fromIterable(getSessionIdResolver().resolveSessionIds(exchange)) .concatMap(this.sessionStore::retrieveSession) .next(); }