我有webflux应用程序,现在,我使用okta进行身份验证。 SecurityWebFilterChain
看起来像:
http
.csrf().disable()
.authorizeExchange()
.pathMatchers("/v2/api-docs",
"/configuration/ui",
"/swagger-resources",
"/swagger-resources/**",
"/configuration/security",
"/swagger-ui.html",
"/webjars/**",
"/**/v2/api-docs")
.permitAll()
.anyExchange().authenticated()
.and()
.oauth2ResourceServer().jwt();
但是现在我需要从prometheus访问执行器指标EP,所以我的想法是为执行器启用基本身份验证,并且仍然使用okta进行休息。可能吗?还是有更好的解决方案?
prometheus.yml
:
scrape_configs:
- job_name: 'springboot'
metrics_path: '/actuator/prometheus'
static_configs:
- targets: ['gateway:8060']
我试图实现两个SecurityWebFilterChain
的bean,第二个是:
http
.authorizeExchange()
.pathMatchers("/actuator/**")
.authenticated()
.and()
.httpBasic();
return http.build();
但是然后我遇到了例外:Caused by: java.lang.IllegalArgumentException: authenticationManager cannot be null