HttpSecurity->ServerHttpSecurity
Issue gh-4615
This commit is contained in:
@@ -48,7 +48,7 @@ import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter
|
||||
@RunWith(SpringJUnit4ClassRunner.class)
|
||||
@ContextConfiguration
|
||||
@WebAppConfiguration
|
||||
public class HttpSecurityHeadersTests {
|
||||
public class ServerHttpSecurityHeadersTests {
|
||||
@Autowired
|
||||
WebApplicationContext wac;
|
||||
@Autowired
|
||||
@@ -39,7 +39,7 @@ import org.springframework.web.context.support.AnnotationConfigWebApplicationCon
|
||||
* @author Rob Winch
|
||||
*
|
||||
*/
|
||||
public class HttpSecurityAntMatchersTests {
|
||||
public class ServerHttpSecurityAntMatchersTests {
|
||||
AnnotationConfigWebApplicationContext context;
|
||||
|
||||
MockHttpServletRequest request;
|
||||
@@ -40,7 +40,7 @@ import org.springframework.web.context.support.AnnotationConfigWebApplicationCon
|
||||
* @author Rob Winch
|
||||
*
|
||||
*/
|
||||
public class HttpSecurityLogoutTests {
|
||||
public class ServerHttpSecurityLogoutTests {
|
||||
AnnotationConfigWebApplicationContext context;
|
||||
|
||||
MockHttpServletRequest request;
|
||||
@@ -43,7 +43,7 @@ import static org.assertj.core.api.Assertions.assertThat;
|
||||
* @author Rob Winch
|
||||
*
|
||||
*/
|
||||
public class HttpSecurityRequestMatchersTests {
|
||||
public class ServerHttpSecurityRequestMatchersTests {
|
||||
AnnotationConfigWebApplicationContext context;
|
||||
|
||||
MockHttpServletRequest request;
|
||||
@@ -268,4 +268,4 @@ public class HttpSecurityRequestMatchersTests {
|
||||
|
||||
this.context.getAutowireCapableBeanFactory().autowireBean(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -26,7 +26,7 @@ import org.springframework.core.annotation.Order;
|
||||
import org.springframework.core.io.buffer.DataBuffer;
|
||||
import org.springframework.core.io.buffer.DefaultDataBufferFactory;
|
||||
import org.springframework.security.authentication.TestingAuthenticationToken;
|
||||
import org.springframework.security.config.web.server.HttpSecurity;
|
||||
import org.springframework.security.config.web.server.ServerHttpSecurity;
|
||||
import org.springframework.security.core.Authentication;
|
||||
import org.springframework.security.core.userdetails.MapReactiveUserDetailsService;
|
||||
import org.springframework.security.core.userdetails.User;
|
||||
@@ -234,7 +234,7 @@ public class EnableWebFluxSecurityTests {
|
||||
}
|
||||
|
||||
@RunWith(SpringRunner.class)
|
||||
public static class MultiHttpSecurity {
|
||||
public static class MultiServerHttpSecurity {
|
||||
@Autowired WebFilterChainProxy springSecurityFilterChain;
|
||||
|
||||
@Test
|
||||
@@ -257,7 +257,7 @@ public class EnableWebFluxSecurityTests {
|
||||
static class Config {
|
||||
@Order(Ordered.HIGHEST_PRECEDENCE)
|
||||
@Bean
|
||||
public SecurityWebFilterChain apiHttpSecurity(HttpSecurity http) {
|
||||
public SecurityWebFilterChain apiHttpSecurity(ServerHttpSecurity http) {
|
||||
http
|
||||
.securityMatcher(new PathPatternParserServerWebExchangeMatcher("/api/**"))
|
||||
.authorizeExchange()
|
||||
@@ -266,7 +266,7 @@ public class EnableWebFluxSecurityTests {
|
||||
}
|
||||
|
||||
@Bean
|
||||
public SecurityWebFilterChain httpSecurity(HttpSecurity http) {
|
||||
public SecurityWebFilterChain httpSecurity(ServerHttpSecurity http) {
|
||||
return http.build();
|
||||
}
|
||||
|
||||
|
||||
@@ -42,7 +42,7 @@ import org.springframework.security.web.FilterChainProxy;
|
||||
* @author Rob Winch
|
||||
*
|
||||
*/
|
||||
public class CustomHttpSecurityConfigurerTests {
|
||||
public class CustomServerHttpSecurityConfigurerTests {
|
||||
@Autowired
|
||||
ConfigurableApplicationContext context;
|
||||
|
||||
@@ -19,7 +19,6 @@ package org.springframework.security.config.web.server;
|
||||
import org.junit.Test;
|
||||
import org.springframework.http.HttpMethod;
|
||||
import org.springframework.security.test.web.reactive.server.WebTestClientBuilder;
|
||||
import org.springframework.security.web.server.authorization.ExceptionTranslationWebFilter;
|
||||
import org.springframework.test.web.reactive.server.WebTestClient;
|
||||
|
||||
/**
|
||||
@@ -27,8 +26,8 @@ import org.springframework.test.web.reactive.server.WebTestClient;
|
||||
* @since 5.0
|
||||
*/
|
||||
public class AuthorizeExchangeBuilderTests {
|
||||
HttpSecurity http = HttpSecurity.http();
|
||||
HttpSecurity.AuthorizeExchangeBuilder authorization = this.http.authorizeExchange();
|
||||
ServerHttpSecurity http = ServerHttpSecurity.http();
|
||||
ServerHttpSecurity.AuthorizeExchangeBuilder authorization = this.http.authorizeExchange();
|
||||
|
||||
@Test
|
||||
public void antMatchersWhenMethodAndPatternsThenDiscriminatesByMethod() {
|
||||
|
||||
@@ -43,7 +43,7 @@ import static org.assertj.core.api.Assertions.assertThat;
|
||||
*/
|
||||
public class FormLoginTests {
|
||||
private UserDetails user = User.withUsername("user").password("password").roles("USER").build();
|
||||
private HttpSecurity http = HttpSecurity.http();
|
||||
private ServerHttpSecurity http = ServerHttpSecurity.http();
|
||||
|
||||
ReactiveAuthenticationManager manager = new UserDetailsRepositoryReactiveAuthenticationManager(new MapReactiveUserDetailsService(this.user));
|
||||
|
||||
|
||||
@@ -41,7 +41,7 @@ import static org.assertj.core.api.AssertionsForInterfaceTypes.assertThat;
|
||||
*/
|
||||
public class HeaderBuilderTests {
|
||||
|
||||
HttpSecurity.HeaderBuilder headers = HttpSecurity.http().headers();
|
||||
ServerHttpSecurity.HeaderBuilder headers = ServerHttpSecurity.http().headers();
|
||||
|
||||
HttpHeaders expectedHeaders = new HttpHeaders();
|
||||
|
||||
|
||||
@@ -35,7 +35,7 @@ import org.springframework.security.test.web.reactive.server.WebTestClientBuilde
|
||||
public class LogoutBuilderTests {
|
||||
|
||||
private UserDetails user = User.withUsername("user").password("password").roles("USER").build();
|
||||
private HttpSecurity http = HttpSecurity.http();
|
||||
private ServerHttpSecurity http = ServerHttpSecurity.http();
|
||||
|
||||
ReactiveAuthenticationManager manager = new UserDetailsRepositoryReactiveAuthenticationManager(new MapReactiveUserDetailsService(this.user));
|
||||
|
||||
|
||||
@@ -44,16 +44,16 @@ import static org.springframework.web.reactive.function.client.ExchangeFilterFun
|
||||
* @since 5.0
|
||||
*/
|
||||
@RunWith(MockitoJUnitRunner.class)
|
||||
public class HttpSecurityTests {
|
||||
public class ServerHttpSecurityTests {
|
||||
@Mock SecurityContextServerRepository contextRepository;
|
||||
@Mock
|
||||
ReactiveAuthenticationManager authenticationManager;
|
||||
|
||||
HttpSecurity http;
|
||||
ServerHttpSecurity http;
|
||||
|
||||
@Before
|
||||
public void setup() {
|
||||
this.http = HttpSecurity.http().headers().and();
|
||||
this.http = ServerHttpSecurity.http().headers().and();
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -80,7 +80,7 @@ public class HttpSecurityTests {
|
||||
this.http.securityContextRepository(new WebSessionSecurityContextServerRepository());
|
||||
this.http.httpBasic();
|
||||
this.http.authenticationManager(this.authenticationManager);
|
||||
HttpSecurity.AuthorizeExchangeBuilder authorize = this.http.authorizeExchange();
|
||||
ServerHttpSecurity.AuthorizeExchangeBuilder authorize = this.http.authorizeExchange();
|
||||
authorize.anyExchange().authenticated();
|
||||
|
||||
WebTestClient client = buildClient();
|
||||
Reference in New Issue
Block a user