This is an automated email from the ASF dual-hosted git repository.
casionone pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/linkis.git
The following commit(s) were added to refs/heads/master by this push:
new 3c556583dc Feature/support eureka auth (#5437)
3c556583dc is described below
commit 3c556583dc876e63508bace5275f7c60c4acbf1e
Author: aiceflower <[email protected]>
AuthorDate: Thu Jun 11 13:13:24 2026 +0800
Feature/support eureka auth (#5437)
* #AI COMMIT# Support Eureka authentication with configurable switch
Add Spring Security support for Eureka server, controlled by
linkis.eureka.auth.enable configuration (default: false).
Co-Authored-By: Claude Opus 4.7 <[email protected]>
* #AI COMMIT# Add logging for Eureka auth enable/disable status
Co-Authored-By: Claude Opus 4.7 <[email protected]>
---------
Co-authored-by: Claude Opus 4.7 <[email protected]>
---
.../linkis-service-discovery/linkis-eureka/pom.xml | 10 +++++
.../apache/linkis/eureka/EurekaSecurityConfig.java | 47 ++++++++++++++++++++++
2 files changed, 57 insertions(+)
diff --git
a/linkis-spring-cloud-services/linkis-service-discovery/linkis-eureka/pom.xml
b/linkis-spring-cloud-services/linkis-service-discovery/linkis-eureka/pom.xml
index 4bfa76e589..33254add42 100644
---
a/linkis-spring-cloud-services/linkis-service-discovery/linkis-eureka/pom.xml
+++
b/linkis-spring-cloud-services/linkis-service-discovery/linkis-eureka/pom.xml
@@ -89,6 +89,16 @@
<artifactId>micrometer-registry-prometheus</artifactId>
<scope>compile</scope>
</dependency>
+ <dependency>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-starter-security</artifactId>
+ <exclusions>
+ <exclusion>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-starter-logging</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
</dependencies>
<build>
diff --git
a/linkis-spring-cloud-services/linkis-service-discovery/linkis-eureka/src/main/java/org/apache/linkis/eureka/EurekaSecurityConfig.java
b/linkis-spring-cloud-services/linkis-service-discovery/linkis-eureka/src/main/java/org/apache/linkis/eureka/EurekaSecurityConfig.java
new file mode 100644
index 0000000000..d296d921a5
--- /dev/null
+++
b/linkis-spring-cloud-services/linkis-service-discovery/linkis-eureka/src/main/java/org/apache/linkis/eureka/EurekaSecurityConfig.java
@@ -0,0 +1,47 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.linkis.eureka;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import
org.springframework.security.config.annotation.web.builders.HttpSecurity;
+import org.springframework.security.web.SecurityFilterChain;
+
+@Configuration
+public class EurekaSecurityConfig {
+
+ private static final Logger logger =
LoggerFactory.getLogger(EurekaSecurityConfig.class);
+
+ @Value("${linkis.eureka.auth.enable:false}")
+ private boolean enableAuth;
+
+ @Bean
+ public SecurityFilterChain securityFilterChain(HttpSecurity http) throws
Exception {
+ http.csrf().disable();
+ if (!enableAuth) {
+ logger.info("Eureka auth is disabled, all requests are permitted");
+ http.authorizeRequests().anyRequest().permitAll();
+ } else {
+ logger.info("Eureka auth is enabled, Spring Security will handle
authentication");
+ }
+ return http.build();
+ }
+}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]