问题描述
我很好奇我有哪些选项可以保护连接(注册和获取迪斯科信息)到 eureka 的服务.显然我想在 Eureka 中打开安全性并为服务指定一个用户名密码.
I am curious about what options I have for securing a service connecting (registering and getting disco info) to eureka. Obviously I want to turn security on in Eureka and specify a username password for service.
我遇到的一个问题是,尝试连接到 eureka 的服务如何指定其凭据?是通过zone的规范,这个引用的格式是什么?
One question that I have is how do services trying to connect to eureka specify their credentials? Is it through the specification of the zone and what is the format of this reference?
*** 我其实已经回答了上面的问题并贴在下面,但还是想知道下面的内容
*** I actually the answer to the above question and posted below, But still wonder about the following
此外,我是否可以指定更严格的安全机制,如果可以,是哪种以及如何指定?
As well, can I specify more strenuous security mechanisms and if so, which and how?
推荐答案
好吧,事实证明,在您发布问题之后,您突然发现了一种做事的方法.
Ok, turns out that after you post an question is when suddenly you discover a way of doing.
我已经弄清楚了我的问题:
I have figured out the part of my question:
在 Eureka 服务器中放这个
in the Eureka server put this
security:
basic:
enabled: true
user:
name: user # login username
password: password
在你的服务中然后把这个
In you service then put this
eureka:
client:
registerWithEureka: true
fetchRegistry: true
serviceUrl:
defaultZone: http://user:password@localhost:8761/eureka/
在此服务向 Eureka 进行身份验证后,Eureka 将拒绝任何没有这些凭据的服务.
After this services are authenticating to Eureka nd Eureka will reject any service without these credentials.
现在进入我问题的第二部分.我可以通过哪些其他更安全的方式保护此连接?
So Now to the second part of my question. What other ways can I secure this connection that are more secure?
这篇关于在 Spring Cloud 中保护 Eureka的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!