-
-
Notifications
You must be signed in to change notification settings - Fork 10.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Enable login authentication for eureka #4663
Enable login authentication for eureka #4663
Conversation
Codecov Report
@@ Coverage Diff @@
## master #4663 +/- ##
============================================
- Coverage 47.16% 47.13% -0.03%
Complexity 1647 1647
============================================
Files 347 347
Lines 10643 10660 +17
Branches 1057 1060 +3
============================================
+ Hits 5020 5025 +5
- Misses 5321 5331 +10
- Partials 302 304 +2
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. |
@Value("${apollo.eureka.server.security.username}") | ||
private String username; | ||
@Value("${apollo.eureka.server.security.password}") | ||
private String password; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about let user can config eureka's username and password in configdb?
- only config once even when scale configservice
but the password will save in configdb
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a good idea! Storing the username/password in the DB makes it consistent among multiple config services.
The only issue here is apollo.eureka.server.security.enabled
, it's hard to read it from DB as it is used in ConditionalOnProperty
, which is triggered before the database initialization phase.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Anilople I changed the implementation a little and the apollo.eureka.server.security
related items could be configured in the configdb, please help to take a look.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How it work?...
Are there some methods read data the from configdb?...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The BizConfig
would put all the ServerConfig
properties to the Spring environment. It won't work for ConditionalOnProperty
as it's initiated later than the ConditionalOnProperty
processing so I put the if (eurekaSecurityEnabled)
check in the method.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It works.
When I change ServerConfig in configdb
then try to access http://localhost:8080/eureka/apps/APOLLO-CONFIGSERVICE
it need auth as expect.
884541c
to
fd96c72
Compare
...rc/main/java/com/ctrip/framework/apollo/configservice/ConfigServerEurekaServerConfigure.java
Show resolved
Hide resolved
@Value("${apollo.eureka.server.security.username}") | ||
private String username; | ||
@Value("${apollo.eureka.server.security.password}") | ||
private String password; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How it work?...
Are there some methods read data the from configdb?...
10e72ca
to
af7e860
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
@Value("${apollo.eureka.server.security.username}") | ||
private String username; | ||
@Value("${apollo.eureka.server.security.password}") | ||
private String password; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It works.
When I change ServerConfig in configdb
then try to access http://localhost:8080/eureka/apps/APOLLO-CONFIGSERVICE
it need auth as expect.
af7e860
to
6ae389f
Compare
What's the purpose of this PR
Enable login authentication for eureka
Brief changelog
Follow this checklist to help us incorporate your contribution quickly and easily:
mvn clean test
to make sure this pull request doesn't break anything.CHANGES
log.