简体   繁体   English

启用安全性后,Spring Cloud Config服务器的凭据不正确

[英]Bad credential with Spring Cloud Config server when security is enable

I create a Spring Cloud Config server. 我创建一个Spring Cloud Config服务器。 I put security in my application.properties file 我将安全性放在了application.properties文件中

security.basic.enabled=false
security.user.name=1user
security.user.password=123

When I try to log to the application with the name and password, I always get 当我尝试使用名称和密码登录到应用程序时,我总是得到

Bad credentials 不好的信用史

I tried to put enabled to true but get same result. 我尝试将enabled设为true,但得到相同的结果。 I saw in the command line then spring generate random password like 我在命令行中看到然后spring生成随机密码,例如

69dfeb52-6320-4085-bcd1-22ee7a3676a2 69dfeb52-6320-4085-bcd1-22ee7a3676a2

if I use with with username user, I can connect. 如果我与用户名user一起使用,则可以连接。

> >

Hi Robert Trudel 你好罗伯特·特鲁德尔

If you are using Spring Boot 2.x, then you need to prefix these properties with spring as shown below: 如果您使用的是Spring Boot 2.x,则需要为这些属性添加spring前缀,如下所示:

spring.security.user.name=1user
spring.security.user.password=123

Also, you do not need this security.basic.enabled=false . 另外,您不需要此security.basic.enabled=false

Hope this helps! 希望这可以帮助!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM