From a061058085da48ca93f97659ab0450d76beb479e Mon Sep 17 00:00:00 2001
From: Lukas Malte Monnerjahn <lukasmalte.monnerjahn@dataport.de>
Date: Wed, 2 Oct 2024 17:49:19 +0200
Subject: [PATCH] remove obsolete webservice config

---
 .../xta/test/app/config/WebServiceConfig.java | 93 -------------------
 1 file changed, 93 deletions(-)
 delete mode 100644 src/main/java/de/ozgcloud/xta/test/app/config/WebServiceConfig.java

diff --git a/src/main/java/de/ozgcloud/xta/test/app/config/WebServiceConfig.java b/src/main/java/de/ozgcloud/xta/test/app/config/WebServiceConfig.java
deleted file mode 100644
index 16bdebb..0000000
--- a/src/main/java/de/ozgcloud/xta/test/app/config/WebServiceConfig.java
+++ /dev/null
@@ -1,93 +0,0 @@
-/*
- * @formatter:off
- *
- * Copyright 2021-2022  Koordinierungsstelle für IT-Standards (KoSIT)
- *
- * Licensed under the European Public License, Version 1.2 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     https://opensource.org/licenses/EUPL-1.2
- *
- * 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.
- * @formatter:on
- */
-package de.ozgcloud.xta.test.app.config;
-
-import org.apache.catalina.Context;
-import org.apache.catalina.connector.Connector;
-import org.apache.tomcat.util.descriptor.web.SecurityCollection;
-import org.apache.tomcat.util.descriptor.web.SecurityConstraint;
-import org.springframework.beans.factory.annotation.Value;
-import org.springframework.boot.web.embedded.tomcat.TomcatServletWebServerFactory;
-import org.springframework.boot.web.servlet.server.ServletWebServerFactory;
-import org.springframework.context.annotation.Bean;
-import org.springframework.context.annotation.Configuration;
-
-import lombok.Getter;
-
-@Configuration
-public class WebServiceConfig {
-
-	@Value("${server.port}")
-	@Getter
-	private int serverPort;
-
-	@Value("${app.server.http-port}")
-	@Getter
-	private int serverHttpPort;
-
-	@Value("${app.server.redirect-to-https:false}")
-	private boolean redirectToHttps;
-
-	@Bean
-	public ServletWebServerFactory servletContainer() {
-		if (redirectToHttps) {
-			return servletContainerRedirectToHttps();
-		}
-		return servletContainerStandardHttp();
-	}
-
-	public ServletWebServerFactory servletContainerStandardHttp() {
-		TomcatServletWebServerFactory tomcat = new TomcatServletWebServerFactory();
-		tomcat.addAdditionalTomcatConnectors(createStandardConnector());
-		return tomcat;
-	}
-
-	private Connector createStandardConnector() {
-		Connector connector = new Connector("org.apache.coyote.http11.Http11NioProtocol");
-		connector.setPort(serverHttpPort);
-		return connector;
-	}
-
-	private ServletWebServerFactory servletContainerRedirectToHttps() {
-		// redirect Http to Https
-		TomcatServletWebServerFactory tomcat = new TomcatServletWebServerFactory() {
-
-			@Override
-			protected void postProcessContext(final Context context) {
-				var securityConstraint = new SecurityConstraint();
-				securityConstraint.setUserConstraint("CONFIDENTIAL");
-				var collection = new SecurityCollection();
-				collection.addPattern("/*");
-				securityConstraint.addCollection(collection);
-				context.addConstraint(securityConstraint);
-			}
-		};
-		tomcat.addAdditionalTomcatConnectors(getHttpConnector());
-		return tomcat;
-	}
-
-	private Connector getHttpConnector() {
-		var connector = new Connector(TomcatServletWebServerFactory.DEFAULT_PROTOCOL);
-		connector.setScheme("http");
-		connector.setPort(serverHttpPort);
-		connector.setSecure(false);
-		connector.setRedirectPort(serverPort);
-		return connector;
-	}
-}
\ No newline at end of file
-- 
GitLab