我有一个SpringBoot应用程序,希望检测正在调用的活动端点,以便允许请求未经验证。
当我提出这个请求时:
http://localhost:8080/001/MyApp/actuator/health/liveness
下面的代码打印出来
false
.
new AntPathRequestMatcher("/**liveness")
isWhitelisted
返回
true
?
public RequestMatcher getRequestMatcher() {
return new OrRequestMatcher(
new AntPathRequestMatcher("/error"),
new AntPathRequestMatcher("/login**"),
new AntPathRequestMatcher("/**logout"),
new AntPathRequestMatcher("/**liveness"));
}
public boolean isWhitelisted(HttpServletRequest httpServletRequest) {
return getRequestMatcher().matches(httpServletRequest);
}
System.out.println(requestPropertyResolver.isWhitelisted(httpServletRequest));