Spring云配置服务器在运行main()时未强制执行基本身份验证
我已经配置了一个Spring云配置服务器来强制进行基本身份验证,下面是我的application.yml文件:Spring云配置服务器在运行main()时未强制执行基本身份验证,spring,maven,spring-security,spring-cloud,spring-cloud-config,Spring,Maven,Spring Security,Spring Cloud,Spring Cloud Config,我已经配置了一个Spring云配置服务器来强制进行基本身份验证,下面是我的application.yml文件: # Config Repo: spring: cloud: config: server: git: uri: file:///${HOME}/microservices_config_repo # Show sensitive information for endpoints: endpoints: sensitiv
# 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启动:运行
服务器端点强制进行基本身份验证。
但是,当我启动Application.main()方法时,基本身份验证已启用,但未强制执行 这意味着我可以在以下位置访问配置: 和 有谁能帮助我理解为什么会发生这种情况,以及如何在运行Application.main()时强制执行基本身份验证,而不仅仅是通过Maven spring启动插件
请注意,当我使用maven将应用程序打包到jar中,然后运行生成的jar时,会强制执行基本身份验证,但仍然不会通过直接运行Application.main的IDE进行验证。也许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
“基本身份验证已启用,但未强制执行”-您如何知道它已启用?另外,听起来你在构建文件中做了一些在IDE中运行应用程序时丢失的事情。我可以卷曲并发布一个包含你的构建文件的文件。是的,ide和jar之间缺少一些内容。朋友,您解决了这个问题吗?我正在尝试一些类似的解决方案。此外,我需要知道是否有其他方法来验证想要访问其配置的客户端。现在,这是正确的测试:例如在邮递员中。你能分享你的代码的github repo吗?提前感谢您也可以共享客户端配置吗?