use of org.springframework.web.server.session.DefaultWebSessionManager in project spring-session by spring-projects.
the class SpringWebSessionConfigurationTests method providedSessionIdResolverShouldBePickedUpAutomatically.
@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);
}
use of org.springframework.web.server.session.DefaultWebSessionManager in project spring-session by spring-projects.
the class SpringWebSessionConfigurationTests method defaultSessionIdResolverShouldBeCookieBased.
@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);
}
use of org.springframework.web.server.session.DefaultWebSessionManager in project spring-security by spring-projects.
the class PathMatcherServerWebExchangeMatcherTests method setup.
@BeforeEach
public void setup() {
MockServerHttpRequest request = MockServerHttpRequest.post("/path").build();
MockServerHttpResponse response = new MockServerHttpResponse();
DefaultWebSessionManager sessionManager = new DefaultWebSessionManager();
this.exchange = MockServerWebExchange.from(request);
this.path = "/path";
this.matcher = new PathPatternParserServerWebExchangeMatcher(this.pattern);
}
use of org.springframework.web.server.session.DefaultWebSessionManager in project spring-framework by spring-projects.
the class FreeMarkerViewTests method subscribeWithoutDemand.
// gh-22754
@Test
public void subscribeWithoutDemand() {
ZeroDemandResponse response = new ZeroDemandResponse();
ServerWebExchange exchange = new DefaultServerWebExchange(MockServerHttpRequest.get("/path").build(), response, new DefaultWebSessionManager(), ServerCodecConfigurer.create(), new AcceptHeaderLocaleContextResolver());
FreeMarkerView view = new FreeMarkerView();
view.setApplicationContext(this.context);
view.setConfiguration(this.freeMarkerConfig);
view.setUrl("test.ftl");
ModelMap model = new ExtendedModelMap();
model.addAttribute("hello", "hi FreeMarker");
view.render(model, null, exchange).subscribe();
response.cancelWrite();
response.checkForLeaks();
}
use of org.springframework.web.server.session.DefaultWebSessionManager in project spring-session by spring-projects.
the class SpringWebSessionConfiguration method webSessionManager.
/**
* Configure a {@link WebSessionManager} using a provided {@link ReactiveSessionRepository}.
*
* @param repository a bean that implements {@link ReactiveSessionRepository}.
* @return a configured {@link WebSessionManager} registered with a preconfigured name.
*/
@Bean(WebHttpHandlerBuilder.WEB_SESSION_MANAGER_BEAN_NAME)
public WebSessionManager webSessionManager(ReactiveSessionRepository<? extends Session> repository) {
SpringSessionWebSessionStore<? extends Session> sessionStore = new SpringSessionWebSessionStore<>(repository);
DefaultWebSessionManager manager = new DefaultWebSessionManager();
manager.setSessionStore(sessionStore);
if (this.webSessionIdResolver != null) {
manager.setSessionIdResolver(this.webSessionIdResolver);
}
return manager;
}
Aggregations