Springboot执行器刷新和总线刷新总是返回401未经授权

问题描述

我从Jenkins撞到bus-refresh端点,我希望该端点不安全。

下面是我的application.yml

management:
  endpoints:
    web:
      exposure:
        include: health,refresh,bus-refresh
      base-path: /
  health:
    ldap:
      enabled: false

下面是我在spring-boot中的http配置

http
                    .anonymous()
                    .and()
                    .authorizeRequests()
                    .antMatchers("/swagger-ui.html","/error","/swagger-resources/**","/webjars/**","/v2/api-docs","/test/**","/api/v1/calculate/**").permitAll()

                    .antMatchers("/health","/refresh/","/bus-refresh/").permitAll()

                    .anyRequest().authenticated()
                    .and()
                    .oauth2ResourceServer()

现在,当我按下curl --request GET http://localhost:8080/health时,我将得到如下正确的响应

{"status":"UP"}

但是当我按下curl --request POST http://localhost:8080/bus-refresh

curl --request POST http://localhost:8080/refresh

我得到403和401

{"timestamp":"2020-08-26T10:46:26.370+00:00","status":403,"error":"Forbidden","message":"","path":"/bus-refresh"}

我已尽力而为,但仍然无法使refreshbus-refresh脱离安全性。需要帮助

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)