Hisoka-X commented on code in PR #8698:
URL: https://github.com/apache/seatunnel/pull/8698#discussion_r1959008138


##########
seatunnel-e2e/seatunnel-engine-e2e/connector-seatunnel-e2e-base/src/test/java/org/apache/seatunnel/engine/e2e/RestApiHttpsIT.java:
##########
@@ -0,0 +1,226 @@
+/*
+ * 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.seatunnel.engine.e2e;
+
+import org.apache.seatunnel.engine.client.SeaTunnelClient;
+import org.apache.seatunnel.engine.client.job.ClientJobExecutionEnvironment;
+import org.apache.seatunnel.engine.client.job.ClientJobProxy;
+import org.apache.seatunnel.engine.common.config.ConfigProvider;
+import org.apache.seatunnel.engine.common.config.JobConfig;
+import org.apache.seatunnel.engine.common.config.SeaTunnelConfig;
+import org.apache.seatunnel.engine.core.job.JobStatus;
+import org.apache.seatunnel.engine.e2e.DummySSLUtil.DummySSLStores;
+import org.apache.seatunnel.engine.server.SeaTunnelServerStarter;
+
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.core.LoggerContext;
+
+import org.awaitility.Awaitility;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+
+import com.hazelcast.client.config.ClientConfig;
+import com.hazelcast.config.Config;
+import com.hazelcast.config.MemberAttributeConfig;
+import com.hazelcast.instance.impl.HazelcastInstanceImpl;
+import lombok.extern.slf4j.Slf4j;
+
+import java.nio.file.Paths;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.concurrent.TimeUnit;
+
+import static io.restassured.RestAssured.given;
+import static 
org.apache.seatunnel.e2e.common.util.ContainerUtil.PROJECT_ROOT_PATH;
+import static org.hamcrest.Matchers.containsString;
+
+@Slf4j
+public class RestApiHttpsIT {

Review Comment:
   I think we can do some refactoring, such as constructing an 
`AbstractRestAPIIT` (move some common code from `RestApiIT`). Then implement 
`RestApiHttpIT` and `RestApiHttpsIT` both, so that we can verify all functions 
instead of just getting the UI.



##########
seatunnel-e2e/seatunnel-engine-e2e/connector-seatunnel-e2e-base/pom.xml:
##########
@@ -34,6 +34,24 @@
     </properties>
 
     <dependencies>
+        <!-- 
https://mvnrepository.com/artifact/org.bouncycastle/bcprov-jdk15on -->
+
+        <dependency>
+            <groupId>org.bouncycastle</groupId>
+            <artifactId>bcprov-jdk18on</artifactId>
+            <version>1.78</version>
+            <!-- or the latest version -->
+        </dependency>
+        <dependency>
+            <groupId>org.bouncycastle</groupId>
+            <artifactId>bcpkix-jdk18on</artifactId>
+            <version>1.78</version>
+        </dependency>
+        <dependency>
+            <groupId>org.bouncycastle</groupId>
+            <artifactId>bcprov-jdk18on</artifactId>
+            <version>1.78</version>
+        </dependency>

Review Comment:
   ```suggestion
           <dependency>
               <groupId>org.bouncycastle</groupId>
               <artifactId>bcprov-jdk18on</artifactId>
               <version>1.78</version>
               <!-- or the latest version -->
           </dependency>
           <dependency>
               <groupId>org.bouncycastle</groupId>
               <artifactId>bcpkix-jdk18on</artifactId>
               <version>1.78</version>
           </dependency>
   ```



##########
seatunnel-engine/seatunnel-engine-server/src/main/java/org/apache/seatunnel/engine/server/JettyService.java:
##########
@@ -88,14 +94,63 @@ public class JettyService {
     public JettyService(NodeEngineImpl nodeEngine, SeaTunnelConfig 
seaTunnelConfig) {
         this.nodeEngine = nodeEngine;
         this.seaTunnelConfig = seaTunnelConfig;
+        this.server = new Server();
+        configureServer();
+    }
+
+    private void configureServer() {

Review Comment:
   So we don't support enable https and http at same time. Please add verify to 
make sure user not open https/http both in config.



##########
docs/en/seatunnel-engine/rest-api-v2.md:
##########
@@ -36,7 +36,39 @@ seatunnel:
       port: 8080
       context-path: /seatunnel
 ```
+#### HTTPS
+Https can also be configured as follows:
 
+```yaml
+
+seatunnel:
+  engine:
+    http:
+      enable-http: true
+      port: 8080
+      enable-https: true
+      https-port: 8443
+      keystore: /path/to/file.keystore
+      keystore-password: keystore_password
+      key-password: key_password
+```
+For optional:Two-way authentication can also be configured as follows:
+
+```yaml
+
+seatunnel:
+  engine:
+    http:
+      enable-http: true

Review Comment:
   ```suggestion
         enable-http: false
   ```



##########
docs/en/seatunnel-engine/rest-api-v2.md:
##########
@@ -36,7 +36,39 @@ seatunnel:
       port: 8080
       context-path: /seatunnel
 ```
+#### HTTPS
+Https can also be configured as follows:
 
+```yaml
+
+seatunnel:
+  engine:
+    http:
+      enable-http: true

Review Comment:
   ```suggestion
         enable-http: false
   ```



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