Skip to content

Commit 25f69e9

Browse files
committed
Merge branch '6.5.x'
2 parents a2d687f + 72eb306 commit 25f69e9

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;
@@ -66,7 +64,6 @@
6664
import org.springframework.security.test.context.support.WithMockUser;
6765
import org.springframework.stereotype.Component;
6866
import org.springframework.test.context.junit.jupiter.SpringExtension;
69-
import org.springframework.web.servlet.ModelAndView;
7067

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

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

755-
Mono<ResponseEntity<Flight>> webFindById(String id) {
756-
Flight flight = this.flights.get(id);
757-
if (flight == null) {
758-
return Mono.just(ResponseEntity.notFound().build());
759-
}
760-
return Mono.just(ResponseEntity.ok(flight));
761-
}
762-
763-
Mono<ModelAndView> webViewFindById(String id) {
764-
Flight flight = this.flights.get(id);
765-
if (flight == null) {
766-
return Mono.just(new ModelAndView("error", HttpStatusCode.valueOf(404)));
767-
}
768-
return Mono.just(new ModelAndView("flights", Map.of("flight", flight)));
769-
}
770-
771710
}
772711

773712
@AuthorizeReturnObject

0 commit comments

Comments
 (0)