Skip to content

Commit 7dd7cbd

Browse files
committed
Update to non-deprecated API
1 parent 05f0758 commit 7dd7cbd

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

spring-grpc-spring-boot-autoconfigure/src/main/java/org/springframework/grpc/autoconfigure/server/security/GrpcServletRequest.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424

2525
import org.springframework.boot.security.servlet.ApplicationContextRequestMatcher;
2626
import org.springframework.grpc.server.service.GrpcServiceDiscoverer;
27-
import org.springframework.security.web.util.matcher.AntPathRequestMatcher;
27+
import org.springframework.security.web.servlet.util.matcher.PathPatternRequestMatcher;
2828
import org.springframework.security.web.util.matcher.OrRequestMatcher;
2929
import org.springframework.security.web.util.matcher.RequestMatcher;
3030
import org.springframework.util.Assert;
@@ -109,7 +109,10 @@ protected boolean ignoreApplicationContext(WebApplicationContext context) {
109109
}
110110

111111
private Stream<RequestMatcher> getDelegateMatchers(GrpcServiceDiscoverer context) {
112-
return getPatterns(context).map(AntPathRequestMatcher::new);
112+
return getPatterns(context).map(path -> {
113+
Assert.hasText(path, "Path must not be empty");
114+
return PathPatternRequestMatcher.withDefaults().matcher(path);
115+
});
113116
}
114117

115118
private Stream<String> getPatterns(GrpcServiceDiscoverer context) {

spring-grpc-spring-boot-autoconfigure/src/test/java/org/springframework/grpc/autoconfigure/server/security/GrpcServletRequestTests.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ private MockHttpServletRequest mockRequest(String path) {
8787
MockServletContext servletContext = new MockServletContext();
8888
servletContext.setAttribute(WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE, this.context);
8989
MockHttpServletRequest request = new MockHttpServletRequest(servletContext);
90-
request.setPathInfo(path);
90+
request.setRequestURI(path);
9191
return request;
9292
}
9393

0 commit comments

Comments
 (0)