Spring 引导安全 - 执行器
Spring boot security - Actuator
我正在尝试将我的应用程序配置为始终公开执行器端点,如果配置设置为表示需要安全性,则将其应用于我的端点以实现 websocket 连接
就目前而言,我的印象是蚂蚁匹配器按顺序匹配 - 这意味着
@Override
protected void configure(HttpSecurity http) throws Exception {
http.authorizeRequests().antMatchers("/health", "/actuator", "actuator/health").permitAll();
if (authenticationRequired) {
http.authorizeRequests().antMatchers("/**").authenticated().and().httpBasic();
}
}
以上代码应允许执行器端点 ALWAYS
看起来好像不是这样。请有人可以帮助描述我的方法有什么问题。
/health
和 /actuator
对我来说应该受 permitAll()
管辖
我使用以下匹配器解决了这个问题
@Override
protected void configure(HttpSecurity http) throws Exception {
http.authorizeRequests().antMatchers("/health", "/actuator/**").permitAll();
if (authenticationRequired) {
http.authorizeRequests().antMatchers("/**").authenticated().and().httpBasic();
}
}
我少了一个前导 /
我正在尝试将我的应用程序配置为始终公开执行器端点,如果配置设置为表示需要安全性,则将其应用于我的端点以实现 websocket 连接
就目前而言,我的印象是蚂蚁匹配器按顺序匹配 - 这意味着
@Override
protected void configure(HttpSecurity http) throws Exception {
http.authorizeRequests().antMatchers("/health", "/actuator", "actuator/health").permitAll();
if (authenticationRequired) {
http.authorizeRequests().antMatchers("/**").authenticated().and().httpBasic();
}
}
以上代码应允许执行器端点 ALWAYS
看起来好像不是这样。请有人可以帮助描述我的方法有什么问题。
/health
和 /actuator
对我来说应该受 permitAll()
我使用以下匹配器解决了这个问题
@Override
protected void configure(HttpSecurity http) throws Exception {
http.authorizeRequests().antMatchers("/health", "/actuator/**").permitAll();
if (authenticationRequired) {
http.authorizeRequests().antMatchers("/**").authenticated().and().httpBasic();
}
}
我少了一个前导 /