use of org.springframework.mock.web.server.MockServerWebExchange in project spring-security by spring-projects.
the class CookieServerRequestCacheTests method getRedirectUriWhenNoCookieThenRedirectUriIsNull.
@Test
public void getRedirectUriWhenNoCookieThenRedirectUriIsNull() {
MockServerWebExchange exchange = MockServerWebExchange.from(MockServerHttpRequest.get("/secured/").accept(MediaType.TEXT_HTML));
URI redirectUri = this.cache.getRedirectUri(exchange).block();
assertThat(redirectUri).isNull();
}
use of org.springframework.mock.web.server.MockServerWebExchange in project spring-security by spring-projects.
the class WebSessionServerRequestCacheTests method saveRequestGetRequestWhenPostThenNotFound.
@Test
public void saveRequestGetRequestWhenPostThenNotFound() {
MockServerWebExchange exchange = MockServerWebExchange.from(MockServerHttpRequest.post("/secured/"));
this.cache.saveRequest(exchange).block();
assertThat(this.cache.getRedirectUri(exchange).block()).isNull();
}
use of org.springframework.mock.web.server.MockServerWebExchange in project spring-security by spring-projects.
the class WebSessionServerRequestCacheTests method saveRequestGetRequestWhenGetThenFound.
@Test
public void saveRequestGetRequestWhenGetThenFound() {
MockServerWebExchange exchange = MockServerWebExchange.from(MockServerHttpRequest.get("/secured/").accept(MediaType.TEXT_HTML));
this.cache.saveRequest(exchange).block();
URI saved = this.cache.getRedirectUri(exchange).block();
assertThat(saved).isEqualTo(exchange.getRequest().getURI());
}
use of org.springframework.mock.web.server.MockServerWebExchange in project spring-security by spring-projects.
the class LoginPageGeneratingWebFilterTests method filterWhenLoginWithContextPathThenActionContainsContextPath.
@Test
public void filterWhenLoginWithContextPathThenActionContainsContextPath() throws Exception {
LoginPageGeneratingWebFilter filter = new LoginPageGeneratingWebFilter();
filter.setFormLoginEnabled(true);
MockServerWebExchange exchange = MockServerWebExchange.from(MockServerHttpRequest.get("/test/login").contextPath("/test"));
filter.filter(exchange, (e) -> Mono.empty()).block();
assertThat(exchange.getResponse().getBodyAsString().block()).contains("action=\"/test/login\"");
}
Aggregations