Skip to content

Commit a6d8c48

Browse files
committed
Merge branch '3.5.x' into 4.0.x
Closes gh-49649
2 parents 1ead08b + 1f2ea4a commit a6d8c48

4 files changed

Lines changed: 8 additions & 7 deletions

File tree

module/spring-boot-security/src/main/java/org/springframework/boot/security/autoconfigure/actuate/web/reactive/EndpointRequest.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -449,12 +449,12 @@ protected boolean ignoreApplicationContext(@Nullable ApplicationContext applicat
449449

450450
@Override
451451
protected ServerWebExchangeMatcher createDelegate(PathMappedEndpoints endpoints) {
452-
Set<String> paths = this.endpoints.stream()
452+
List<ServerWebExchangeMatcher> delegateMatchers = this.endpoints.stream()
453453
.filter(Objects::nonNull)
454454
.map(this::getEndpointId)
455455
.flatMap((endpointId) -> streamAdditionalPaths(endpoints, endpointId))
456-
.collect(Collectors.toCollection(LinkedHashSet::new));
457-
List<ServerWebExchangeMatcher> delegateMatchers = getDelegateMatchers(paths, this.httpMethod);
456+
.map(PathPatternParserServerWebExchangeMatcher::new)
457+
.collect(Collectors.toCollection(ArrayList::new));
458458
return (!CollectionUtils.isEmpty(delegateMatchers)) ? new OrServerWebExchangeMatcher(delegateMatchers)
459459
: EMPTY_MATCHER;
460460
}

module/spring-boot-security/src/main/java/org/springframework/boot/security/autoconfigure/actuate/web/servlet/EndpointRequest.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -456,13 +456,12 @@ protected RequestMatcher createDelegate(WebApplicationContext context,
456456
RequestMatcherFactory requestMatcherFactory) {
457457
PathMappedEndpoints endpoints = context.getBean(PathMappedEndpoints.class);
458458
RequestMatcherProvider matcherProvider = getRequestMatcherProvider(context);
459-
Set<String> paths = this.endpoints.stream()
459+
List<RequestMatcher> delegateMatchers = this.endpoints.stream()
460460
.filter(Objects::nonNull)
461461
.map(this::getEndpointId)
462462
.flatMap((endpointId) -> streamAdditionalPaths(endpoints, endpointId))
463-
.collect(Collectors.toCollection(LinkedHashSet::new));
464-
List<RequestMatcher> delegateMatchers = getDelegateMatchers(requestMatcherFactory, matcherProvider, paths,
465-
this.httpMethod);
463+
.map((path) -> requestMatcherFactory.antPath(matcherProvider, this.httpMethod, path))
464+
.collect(Collectors.toCollection(ArrayList::new));
466465
return (!CollectionUtils.isEmpty(delegateMatchers)) ? new OrRequestMatcher(delegateMatchers)
467466
: EMPTY_MATCHER;
468467
}

module/spring-boot-security/src/test/java/org/springframework/boot/security/autoconfigure/actuate/web/reactive/EndpointRequestTests.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -317,6 +317,7 @@ void toAdditionalPathsWithEndpointClassShouldNotMatchOtherPaths() {
317317
FooEndpoint.class);
318318
RequestMatcherAssert assertMatcher = assertMatcher(matcher, new PathMappedEndpoints("",
319319
() -> List.of(mockEndpoint(EndpointId.of("foo"), "test", WebServerNamespace.SERVER, "/additional"))));
320+
assertMatcher.doesNotMatch("/additional/foo");
320321
assertMatcher.doesNotMatch("/foo");
321322
assertMatcher.doesNotMatch("/bar");
322323
}

module/spring-boot-security/src/test/java/org/springframework/boot/security/autoconfigure/actuate/web/servlet/EndpointRequestTests.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -322,6 +322,7 @@ void toAdditionalPathsWithEndpointClassShouldNotMatchOtherPaths() {
322322
FooEndpoint.class);
323323
RequestMatcherAssert assertMatcher = assertMatcher(matcher, new PathMappedEndpoints("",
324324
() -> List.of(mockEndpoint(EndpointId.of("foo"), "test", WebServerNamespace.SERVER, "/additional"))));
325+
assertMatcher.doesNotMatch("/additional/foo");
325326
assertMatcher.doesNotMatch("/foo");
326327
assertMatcher.doesNotMatch("/bar");
327328
}

0 commit comments

Comments
 (0)