ruanwenjun commented on code in PR #17577:
URL: 
https://github.com/apache/dolphinscheduler/pull/17577#discussion_r2480450444


##########
dolphinscheduler-authentication/dolphinscheduler-actuator-authentication/src/main/java/org/apache/dolphinscheduler/authentication/actuator/config/ActuatorSecurityConfig.java:
##########
@@ -0,0 +1,158 @@
+/*
+ * 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.dolphinscheduler.common.config;
+
+import org.apache.commons.lang3.StringUtils;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import lombok.Getter;
+import lombok.Setter;
+import lombok.ToString;
+
+import org.springframework.boot.context.properties.ConfigurationProperties;
+import 
org.springframework.boot.context.properties.EnableConfigurationProperties;
+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.config.annotation.web.configuration.EnableWebSecurity;
+import org.springframework.security.core.userdetails.User;
+import org.springframework.security.core.userdetails.UserDetails;
+import org.springframework.security.core.userdetails.UserDetailsService;
+import org.springframework.security.provisioning.InMemoryUserDetailsManager;
+import org.springframework.security.web.SecurityFilterChain;
+import org.springframework.security.web.util.matcher.AntPathRequestMatcher;
+
+/**
+ * Security configuration for Actuator endpoints.
+ * <p>
+ * This configuration applies security rules to Actuator paths such as:
+ * <ul>
+ *   <li>/actuator/</li>
+ *   <li>/dolphinscheduler/actuator/</li>
+ * </ul>
+ * Security can be enabled/disabled via {@code management.security.enabled}.
+ * When enabled, HTTP Basic authentication is required with a configured 
username and password.
+ * </p>
+ */
+@Configuration
+@EnableWebSecurity
+@EnableConfigurationProperties(ActuatorSecurityConfig.ActuatorSecurityProperties.class)
+public class ActuatorSecurityConfig {

Review Comment:
   We should add this in alert/api/master/worker module,please don't add into 
common module.



##########
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/ApiApplicationServer.java:
##########
@@ -44,7 +45,8 @@
         CommonConfiguration.class,
         ServiceConfiguration.class,
         StorageConfiguration.class,
-        RegistryConfiguration.class})
+        RegistryConfiguration.class,
+        ActuatorConfiguration.class})

Review Comment:
   ```suggestion})
   ```
   
   Remove this, using springboot AutoConfiguration feature



##########
dolphinscheduler-authentication/dolphinscheduler-actuator-authentication/pom.xml:
##########
@@ -0,0 +1,37 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0"; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
http://maven.apache.org/xsd/maven-4.0.0.xsd";>
+    <modelVersion>4.0.0</modelVersion>
+    <parent>
+        <groupId>org.apache.dolphinscheduler</groupId>
+        <artifactId>dolphinscheduler-authentication</artifactId>
+        <version>dev-SNAPSHOT</version>
+    </parent>
+
+    <artifactId>dolphinscheduler-actuator-authentication</artifactId>
+
+    <properties>
+        <maven.compiler.source>8</maven.compiler.source>
+        <maven.compiler.target>8</maven.compiler.target>
+        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>

Review Comment:
   remove this.



##########
dolphinscheduler-common/pom.xml:
##########
@@ -47,6 +47,11 @@
             <artifactId>dolphinscheduler-aws-authentication</artifactId>
         </dependency>
 
+        <dependency>
+            <groupId>org.apache.dolphinscheduler</groupId>
+            <artifactId>dolphinscheduler-actuator-authentication</artifactId>
+        </dependency>

Review Comment:
   Remove this, add this into api/master/worker/alert



##########
dolphinscheduler-authentication/dolphinscheduler-actuator-authentication/src/main/java/org/apache/dolphinscheduler/authentication/actuator/config/ActuatorSecurityConfig.java:
##########
@@ -0,0 +1,158 @@
+/*
+ * 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.dolphinscheduler.authentication.actuator.config;
+
+import org.apache.commons.lang3.StringUtils;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import lombok.Getter;
+import lombok.Setter;
+import lombok.ToString;
+
+import org.springframework.boot.context.properties.ConfigurationProperties;
+import 
org.springframework.boot.context.properties.EnableConfigurationProperties;
+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.config.annotation.web.configuration.EnableWebSecurity;
+import org.springframework.security.core.userdetails.User;
+import org.springframework.security.core.userdetails.UserDetails;
+import org.springframework.security.core.userdetails.UserDetailsService;
+import org.springframework.security.provisioning.InMemoryUserDetailsManager;
+import org.springframework.security.web.SecurityFilterChain;
+import org.springframework.security.web.util.matcher.AntPathRequestMatcher;
+
+/**
+ * Security configuration for Actuator endpoints.
+ * <p>
+ * This configuration applies security rules to Actuator paths such as:
+ * <ul>
+ *   <li>/actuator/</li>
+ *   <li>/dolphinscheduler/actuator/</li>
+ * </ul>
+ * Security can be enabled/disabled via {@code management.security.enabled}.
+ * When enabled, HTTP Basic authentication is required with a configured 
username and password.
+ * </p>
+ */
+@Configuration
+@EnableWebSecurity
+@EnableConfigurationProperties(ActuatorSecurityConfig.ActuatorSecurityProperties.class)
+public class ActuatorSecurityConfig {

Review Comment:
   ActuatorAuthenticationAutoConfiguration



##########
dolphinscheduler-authentication/dolphinscheduler-actuator-authentication/src/main/java/org/apache/dolphinscheduler/authentication/actuator/ActuatorConfiguration.java:
##########
@@ -0,0 +1,26 @@
+/*
+ * 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.dolphinscheduler.authentication.actuator;
+
+import org.springframework.context.annotation.ComponentScan;
+import org.springframework.context.annotation.Configuration;
+
+@Configuration
+@ComponentScan("org.apache.dolphinscheduler.authentication.actuator")
+public class ActuatorConfiguration {

Review Comment:
   Remove this class.



-- 
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]

Reply via email to