我需要完全绕过Spring Boot 2.0应用程序中某些端点的安全性(身份验证/授权),例如“/version”和“/robots.txt”,但是对于所有其他端点,需要保持安全性。
更为复杂的是,我正在一个较大项目的一部分中工作。我的公司有另一个小组提供了一个使用Spring Security的库。这非常重要,因为这意味着我不能简单地覆盖Spring Security类以使其正常工作 - 这些类已经被其他代码覆盖,我无法控制。
是否有一种方法可以配置Spring Boot 2.0以绕过某些端点的身份验证?
在Spring Boot 1.5中,我们可以在application.yml文件中指定此设置: security.ignored: /version 但在Spring Boot 2.0中,此方法不再起作用。
management.security.enabled=true
。 - pvpkiran.antMatchers('/swagger-ui.html').permitAll()
的antMatcher来配置configure(HttpSecurity httpSecurity)
。 - Federico Piazza