Skip to content

Commit 72eb306

Browse files
committed
Remove AuthorizationWebProxyConfiguration From Reactive
Closes gh-17545
1 parent d2fcba8 commit 72eb306

File tree

2 files changed

+0
-67
lines changed

2 files changed

+0
-67
lines changed

config/src/main/java/org/springframework/security/config/annotation/method/configuration/ReactiveMethodSecuritySelector.java

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,6 @@ class ReactiveMethodSecuritySelector implements ImportSelector {
3838
private static final boolean isDataPresent = ClassUtils
3939
.isPresent("org.springframework.security.data.aot.hint.AuthorizeReturnObjectDataHintsRegistrar", null);
4040

41-
private static final boolean isWebPresent = ClassUtils.isPresent("org.springframework.web.server.ServerWebExchange",
42-
null);
43-
4441
private static final boolean isObservabilityPresent = ClassUtils
4542
.isPresent("io.micrometer.observation.ObservationRegistry", null);
4643

@@ -64,9 +61,6 @@ public String[] selectImports(AnnotationMetadata importMetadata) {
6461
if (isDataPresent) {
6562
imports.add(AuthorizationProxyDataConfiguration.class.getName());
6663
}
67-
if (isWebPresent) {
68-
imports.add(AuthorizationProxyWebConfiguration.class.getName());
69-
}
7064
if (isObservabilityPresent) {
7165
imports.add(ReactiveMethodObservationConfiguration.class.getName());
7266
}

config/src/test/java/org/springframework/security/config/annotation/method/configuration/PrePostReactiveMethodSecurityConfigurationTests.java

Lines changed: 0 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,6 @@
4040
import org.springframework.context.annotation.Bean;
4141
import org.springframework.context.annotation.Configuration;
4242
import org.springframework.context.annotation.Role;
43-
import org.springframework.http.HttpStatusCode;
44-
import org.springframework.http.ResponseEntity;
4543
import org.springframework.security.access.AccessDeniedException;
4644
import org.springframework.security.access.PermissionEvaluator;
4745
import org.springframework.security.access.annotation.Secured;
@@ -67,7 +65,6 @@
6765
import org.springframework.security.test.context.support.WithMockUser;
6866
import org.springframework.stereotype.Component;
6967
import org.springframework.test.context.junit.jupiter.SpringExtension;
70-
import org.springframework.web.servlet.ModelAndView;
7168

7269
import static org.assertj.core.api.Assertions.assertThat;
7370
import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
@@ -364,48 +361,6 @@ public void findByIdWhenUnauthorizedResultThenDenies() {
364361
assertThatExceptionOfType(AccessDeniedException.class).isThrownBy(() -> flight.getAltitude().block());
365362
}
366363

367-
@Test
368-
@WithMockUser(authorities = "airplane:read")
369-
public void findByIdWhenAuthorizedResponseEntityThenAuthorizes() {
370-
this.spring.register(AuthorizeResultConfig.class).autowire();
371-
FlightRepository flights = this.spring.getContext().getBean(FlightRepository.class);
372-
Flight flight = flights.webFindById("1").block().getBody();
373-
assertThatNoException().isThrownBy(() -> flight.getAltitude().block());
374-
assertThatNoException().isThrownBy(() -> flight.getSeats().block());
375-
}
376-
377-
@Test
378-
@WithMockUser(authorities = "seating:read")
379-
public void findByIdWhenUnauthorizedResponseEntityThenDenies() {
380-
this.spring.register(AuthorizeResultConfig.class).autowire();
381-
FlightRepository flights = this.spring.getContext().getBean(FlightRepository.class);
382-
Flight flight = flights.webFindById("1").block().getBody();
383-
assertThatNoException().isThrownBy(() -> flight.getSeats().block());
384-
assertThatExceptionOfType(AccessDeniedException.class).isThrownBy(() -> flight.getAltitude().block());
385-
}
386-
387-
@Test
388-
@WithMockUser(authorities = "airplane:read")
389-
public void findByIdWhenAuthorizedModelAndViewThenAuthorizes() {
390-
this.spring.register(AuthorizeResultConfig.class).autowire();
391-
FlightRepository flights = this.spring.getContext().getBean(FlightRepository.class);
392-
Flight flight = (Flight) flights.webViewFindById("1").block().getModel().get("flight");
393-
assertThatNoException().isThrownBy(() -> flight.getAltitude().block());
394-
assertThatNoException().isThrownBy(() -> flight.getSeats().block());
395-
assertThat(flights.webViewFindById("5").block().getModel().get("flight")).isNull();
396-
}
397-
398-
@Test
399-
@WithMockUser(authorities = "seating:read")
400-
public void findByIdWhenUnauthorizedModelAndViewThenDenies() {
401-
this.spring.register(AuthorizeResultConfig.class).autowire();
402-
FlightRepository flights = this.spring.getContext().getBean(FlightRepository.class);
403-
Flight flight = (Flight) flights.webViewFindById("1").block().getModel().get("flight");
404-
assertThatNoException().isThrownBy(() -> flight.getSeats().block());
405-
assertThatExceptionOfType(AccessDeniedException.class).isThrownBy(() -> flight.getAltitude().block());
406-
assertThat(flights.webViewFindById("5").block().getModel().get("flight")).isNull();
407-
}
408-
409364
@Test
410365
@WithMockUser(authorities = "seating:read")
411366
public void findAllWhenUnauthorizedResultThenDenies() {
@@ -769,22 +724,6 @@ Mono<Void> remove(String id) {
769724
return Mono.empty();
770725
}
771726

772-
Mono<ResponseEntity<Flight>> webFindById(String id) {
773-
Flight flight = this.flights.get(id);
774-
if (flight == null) {
775-
return Mono.just(ResponseEntity.notFound().build());
776-
}
777-
return Mono.just(ResponseEntity.ok(flight));
778-
}
779-
780-
Mono<ModelAndView> webViewFindById(String id) {
781-
Flight flight = this.flights.get(id);
782-
if (flight == null) {
783-
return Mono.just(new ModelAndView("error", HttpStatusCode.valueOf(404)));
784-
}
785-
return Mono.just(new ModelAndView("flights", Map.of("flight", flight)));
786-
}
787-
788727
}
789728

790729
@AuthorizeReturnObject

0 commit comments

Comments
 (0)