This is an automated email from the ASF dual-hosted git repository. aiceflower pushed a commit to branch feature/support-eureka-auth in repository https://gitbox.apache.org/repos/asf/linkis.git
commit 25d52ca2beb6af52b097cdb55cf3b4828c2b5fe8 Author: aiceflower <[email protected]> AuthorDate: Wed Jun 10 17:48:31 2026 +0800 #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]> --- .../linkis-service-discovery/linkis-eureka/pom.xml | 10 ++++++ .../apache/linkis/eureka/EurekaSecurityConfig.java | 40 ++++++++++++++++++++++ 2 files changed, 50 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..c23015506e --- /dev/null +++ b/linkis-spring-cloud-services/linkis-service-discovery/linkis-eureka/src/main/java/org/apache/linkis/eureka/EurekaSecurityConfig.java @@ -0,0 +1,40 @@ +/* + * 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.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 { + + @Value("${linkis.eureka.auth.enable:false}") + private boolean enableAuth; + + @Bean + public SecurityFilterChain securityFilterChain(HttpSecurity http) throws Exception { + http.csrf().disable(); + if (!enableAuth) { + http.authorizeRequests().anyRequest().permitAll(); + } + return http.build(); + } +} --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
