【发布时间】:2020-12-15 03:44:51
【问题描述】:
我正在使用我的 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"}
我尽我所能,但仍然无法将refresh 和bus-refresh 都带出安全性。需要帮助
【问题讨论】:
-
你明白了吗?我遇到了同样的问题,我不知道出了什么问题。
-
不.. 我宁愿保护端点,并让我的管道在每次到达端点时获取承载令牌
标签: spring-boot spring-security spring-boot-actuator