diff --git a/openvidu-test-browsers/pom.xml b/openvidu-test-browsers/pom.xml index 5da33c85..23eb9a0a 100644 --- a/openvidu-test-browsers/pom.xml +++ b/openvidu-test-browsers/pom.xml @@ -67,6 +67,11 @@ spring-boot-starter-web ${version.spring-boot} + + org.springframework.boot + spring-boot-starter-security + ${version.spring-boot} + org.slf4j slf4j-api diff --git a/openvidu-test-browsers/src/main/java/io/openvidu/test/browsers/utils/CustomWebhook.java b/openvidu-test-browsers/src/main/java/io/openvidu/test/browsers/utils/CustomWebhook.java index 420fa85d..a0fe6401 100644 --- a/openvidu-test-browsers/src/main/java/io/openvidu/test/browsers/utils/CustomWebhook.java +++ b/openvidu-test-browsers/src/main/java/io/openvidu/test/browsers/utils/CustomWebhook.java @@ -17,7 +17,6 @@ package io.openvidu.test.browsers.utils; -import java.util.Collections; import java.util.Map; import java.util.concurrent.BlockingQueue; import java.util.concurrent.ConcurrentHashMap; @@ -27,11 +26,14 @@ import java.util.concurrent.TimeUnit; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.boot.builder.SpringApplicationBuilder; import org.springframework.boot.context.event.ApplicationReadyEvent; import org.springframework.context.ConfigurableApplicationContext; +import org.springframework.context.annotation.Configuration; import org.springframework.context.event.EventListener; +import org.springframework.security.config.annotation.web.builders.HttpSecurity; +import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; @@ -52,9 +54,8 @@ public class CustomWebhook { public static void main(String[] args, CountDownLatch initLatch) { CustomWebhook.initLatch = initLatch; - SpringApplication app = new SpringApplication(CustomWebhook.class); - app.setDefaultProperties(Collections.singletonMap("server.port", "7777")); - CustomWebhook.context = app.run(args); + CustomWebhook.context = new SpringApplicationBuilder(CustomWebhook.class) + .properties("spring.config.location:classpath:aplication-pro-webhook.properties").build().run(args); } public static void shutDown() { @@ -92,4 +93,13 @@ public class CustomWebhook { CustomWebhook.initLatch.countDown(); } + @Configuration + public class SecurityConfig extends WebSecurityConfigurerAdapter { + @Override + protected void configure(HttpSecurity http) throws Exception { + http.requiresChannel().antMatchers("/webhook").requiresInsecure(); + http.csrf().disable().authorizeRequests().antMatchers("/webhook").permitAll(); + } + } + } diff --git a/openvidu-test-browsers/src/main/resources/aplication-pro-webhook.properties b/openvidu-test-browsers/src/main/resources/aplication-pro-webhook.properties new file mode 100644 index 00000000..ff825235 --- /dev/null +++ b/openvidu-test-browsers/src/main/resources/aplication-pro-webhook.properties @@ -0,0 +1,2 @@ +server.port=7777 +server.ssl.enabled=false \ No newline at end of file diff --git a/openvidu-test-e2e/jenkins/Jenkinsfile b/openvidu-test-e2e/jenkins/Jenkinsfile index 9ae1e487..b109223b 100644 --- a/openvidu-test-e2e/jenkins/Jenkinsfile +++ b/openvidu-test-e2e/jenkins/Jenkinsfile @@ -61,7 +61,7 @@ node('container') { sh(script: '''#!/bin/bash if [ "$DOCKER_RECORDING_VERSION" != "default" ]; then echo "Using custom openvidu-recording tag: $DOCKER_RECORDING_VERSION" - cd openvidu/openvidu-server/target && java -jar -Dopenvidu.publicurl=https://172.17.0.1:4443/ -Dopenvidu.recording=true -Dopenvidu.recording.version=$DOCKER_RECORDING_VERSION -Dopenvidu.webhook=true -Dopenvidu.webhook.endpoint=http://172.17.0.1:7777/webhook/ openvidu-server-*.jar &> /openvidu-server.log & + cd openvidu/openvidu-server/target && java -jar -Dopenvidu.publicurl=https://172.17.0.1:4443/ -Dopenvidu.recording=true -Dopenvidu.recording.version=$DOCKER_RECORDING_VERSION -Dopenvidu.webhook=true -Dopenvidu.webhook.endpoint=http://localhost:7777/webhook/ openvidu-server-*.jar &> /openvidu-server.log & else echo "Using default openvidu-recording tag" cd openvidu/openvidu-server/target && java -jar -Dopenvidu.publicurl=https://172.17.0.1:4443/ -Dopenvidu.recording=true -Dopenvidu.webhook=true -Dopenvidu.webhook.endpoint=http://localhost:7777/webhook/ openvidu-server-*.jar &> /openvidu-server.log &