[英]Spring Cloud Config Client not fetching config when Spring Security is active on Spring Cloud Config Server
[英]Spring Cloud Config Server not enforcing BASIC Authentication when running main()
我已經配置了一個 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
服務器端點強制基本身份驗證。 但是當我啟動 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 Authentication,但仍然不是通過 IDE 直接運行 Application.main。
也許 oy Yaml 的格式對我來說似乎是這樣的:
server:
port:9999
spring:
application:
name: config-server-sample
cloud:
config:
name: ${spring.application.name}
fail-fast: true
server:
git:
uri: url
username: xx
password: zz
default-label: master
basedir: '${user.home}/${spring.application.name}/default'
timeout: 10
clone-on-start: true
force-pull: true
security:
basic:
enabled: true
path: /**
ignored: /health**,/info**,/metrics**,/trace**
user:
name: admin
password: tupassword
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.