use of org.springframework.security.config.web.server.FormLoginTests.HomePage in project spring-security by spring-projects.
the class RequestCacheTests method requestCacheNoOp.
@Test
public void requestCacheNoOp() {
// @formatter:off
SecurityWebFilterChain securityWebFilter = this.http.authorizeExchange().anyExchange().authenticated().and().formLogin().and().requestCache().requestCache(NoOpServerRequestCache.getInstance()).and().build();
WebTestClient webTestClient = WebTestClient.bindToController(new SecuredPageController(), new WebTestClientBuilder.Http200RestController()).webFilter(new WebFilterChainProxy(securityWebFilter)).build();
WebDriver driver = WebTestClientHtmlUnitDriverBuilder.webTestClientSetup(webTestClient).build();
// @formatter:on
DefaultLoginPage loginPage = SecuredPage.to(driver, DefaultLoginPage.class).assertAt();
// @formatter:off
HomePage securedPage = loginPage.loginForm().username("user").password("password").submit(HomePage.class);
// @formatter:on
securedPage.assertAt();
}
use of org.springframework.security.config.web.server.FormLoginTests.HomePage in project spring-security by spring-projects.
the class RequestCacheTests method requestWhenCustomRequestCacheInLambdaThenCustomCacheUsed.
@Test
public void requestWhenCustomRequestCacheInLambdaThenCustomCacheUsed() {
// @formatter:off
SecurityWebFilterChain securityWebFilter = this.http.authorizeExchange((exchange) -> exchange.anyExchange().authenticated()).formLogin(withDefaults()).requestCache((requestCache) -> requestCache.requestCache(NoOpServerRequestCache.getInstance())).build();
WebTestClient webTestClient = WebTestClient.bindToController(new SecuredPageController(), new WebTestClientBuilder.Http200RestController()).webFilter(new WebFilterChainProxy(securityWebFilter)).build();
WebDriver driver = WebTestClientHtmlUnitDriverBuilder.webTestClientSetup(webTestClient).build();
// @formatter:on
DefaultLoginPage loginPage = SecuredPage.to(driver, DefaultLoginPage.class).assertAt();
// @formatter:off
HomePage securedPage = loginPage.loginForm().username("user").password("password").submit(HomePage.class);
// @formatter:on
securedPage.assertAt();
}
Aggregations