Spring 加载 swagger 时对所有服务的安全调用 UI
Spring security call for all the services when loading swagger UI
我正在使用 springdoc-openapi-ui。当我加载 swagger 页面时,在加载 swagger UI 时会为所有 API 调用 spring-security。我有 spring 安全措施。我的期望是当我试图从 swagger 中攻击特定的 API 时应该调用安全性。
我的招摇 UI link 如下所示
'http://localhost:8080/swagger-ui/index.html?configUrl=/v3/api-docs/swagger-config'
当我使用 springfox-swagger-ui 时,它按预期工作。
最近我已经迁移到 springdoc-openapi-ui.
Swagger 端点更改为 springdoc-openapi-ui
的新映射。在 SecurityConfiguration
中进行了相同的更改。现在在加载 swagger ui
安全性时不会调用。
public abstract class SecurityConfiguration extends WebSecurityConfigurerAdapter {
@Override
protected void configure(HttpSecurity http) throws Exception {
}
@Override
public void configure(WebSecurity web) throws Exception {
web.ignoring().antMatchers(HttpMethod.OPTIONS, "/**").antMatchers("/v3/api-docs/**",
"/swagger-ui/**", "/swagger-ui/index.html/**");
}
}
我正在使用 springdoc-openapi-ui。当我加载 swagger 页面时,在加载 swagger UI 时会为所有 API 调用 spring-security。我有 spring 安全措施。我的期望是当我试图从 swagger 中攻击特定的 API 时应该调用安全性。
我的招摇 UI link 如下所示
'http://localhost:8080/swagger-ui/index.html?configUrl=/v3/api-docs/swagger-config'
当我使用 springfox-swagger-ui 时,它按预期工作。 最近我已经迁移到 springdoc-openapi-ui.
Swagger 端点更改为 springdoc-openapi-ui
的新映射。在 SecurityConfiguration
中进行了相同的更改。现在在加载 swagger ui
安全性时不会调用。
public abstract class SecurityConfiguration extends WebSecurityConfigurerAdapter {
@Override
protected void configure(HttpSecurity http) throws Exception {
}
@Override
public void configure(WebSecurity web) throws Exception {
web.ignoring().antMatchers(HttpMethod.OPTIONS, "/**").antMatchers("/v3/api-docs/**",
"/swagger-ui/**", "/swagger-ui/index.html/**");
}
}