kinghao007 opened a new issue, #5319: URL: https://github.com/apache/linkis/issues/5319
### Search before asking - [x] I searched the [issues](https://github.com/apache/linkis/issues) and found no similar issues. ### Linkis Component linkis-mg-eureka ### What happened 在Eureka配置文件中配置了账号密码,但是配置不生效,导致Eureka服务无法正常启动或认证失败。 **问题描述:** 用户在 `application-eureka.yml` 或相关配置文件中配置了Eureka的安全认证信息: ```yaml eureka: server: username: admin password: linkis123 ``` 但是配置的账号密码没有生效,服务启动后仍然可以无认证访问Eureka,或者其他服务连接Eureka时认证失败。 ### What you expected to happen 配置的Eureka账号密码应该生效: 1. Eureka Server启动后需要认证才能访问 2. 其他Linkis服务能够使用配置的账号密码成功注册到Eureka 3. Eureka Dashboard需要登录才能访问 ### How to reproduce 1. 在 `application-eureka.yml` 中配置账号密码 2. 启动 linkis-mg-eureka 服务 3. 尝试访问 Eureka Dashboard (http://ip:20303/) 4. 观察是否需要认证,或者其他服务是否能正常注册 ### Anything else **根本原因:** Eureka的安全认证需要引入Spring Security相关依赖才能生效,仅配置参数是不够的。 **解决方案:** 1. 在 `linkis-mg-eureka` 的 `pom.xml` 中添加 Spring Security 依赖: ```xml <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-security</artifactId> </dependency> ``` 2. 添加 Security 配置类,启用基本认证 3. 确保其他服务的Eureka客户端配置包含认证信息 ### Are you willing to submit a PR? - [ ] Yes I am willing to submit a PR! ### Linkis Version 1.8.0 ### Java Version OpenJDK 1.8.0 ### Additional Information 相关技术要点: - Spring Security 基本认证配置 - Eureka Client 认证配置 - 配置加密存储(可选) 参考文档: - Spring Cloud Eureka Security: https://cloud.spring.io/spring-cloud-netflix/reference/html/#spring-cloud-eureka-server -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
