我已经配置了一个Spring Cloud Config服务器来强制进行BASIC身份验证,这里是我的application.yml文件:
# Config Repo:
spring:
cloud:
config:
server:
git:
uri: file:///${HOME}/microservices_config_repo
# Show sensitive information for endpoints:
endpoints:
sensitive: true
# Security for endpoints:
management:
security:
enabled: true
security:
user:
name: user1
password: changeme
我遇到的问题是当我启动服务器时:mvn spring-boot:run
服务器 endpoints FORCE BASIC身份验证 . 但是当我启动Application.main()方法时,BASIC身份验证已启用,但未强制执行 .
意思是我可以访问以下配置:http://localhost:8888/client-config和http://user1:changeme@localhost:8888/client-config
任何人都可以帮助我理解为什么会这样,以及如何在运行Application.main()时强制执行BASIC身份验证,而不仅仅是通过Maven spring-boot插件?
注意,当我使用maven将应用程序打包到jar中时,然后运行生成的jar,强制执行BASIC身份验证,但仍然不能通过直接运行Application.main的IDE .