我有一个嵌入式Spring Cloud Config服务器和客户端 . 我想阻止所有用户访问 https://host:port/config/* endpoints . 在我目前的情况下,例如,对 https://host:port/config/application.yml 执行 HTTP GET 请求的任何人都可以看到整个应用程序配置 . 在 Spring 季文档中提到我可以使用如下的用户名和密码来阻止它:

7.6安全性如果您在服务器上使用HTTP Basic安全性,则客户端只需要知道密码(如果不是默认值,则使用用户名) . 您可以通过配置服务器URI或通过单独的用户名和密码属性来实现,例如

bootstrap.yml

spring: 
  cloud:
    config:
      uri: https://user:secret@myconfig.mycompany.com

要么

bootstrap.yml

spring:   
  cloud:
    config:
      uri: https://myconfig.mycompany.com
      username: user
      password: secret

spring.cloud.config.password和spring.cloud.config.username值覆盖URI中提供的任何内容 .

我当前的 bootstrap.yml 配置如下:

spring:
  application:
    name: 'MyApp'
  cloud:
      config:
        uri: 'http://localhost:${server.port}/config'
        enabled: true
        server:
            native:
                search-locations: '${config.location}'
            bootstrap: true
            prefix: '/config'

有没有办法在不使用用户名和密码的情况下实现这一目标?