This repository has been archived by the owner on Jun 20, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
50 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
#Wed Mar 25 19:35:05 CET 2020 | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-6.2.2-all.zip | ||
distributionBase=GRADLE_USER_HOME | ||
distributionPath=wrapper/dists | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-6.2.2-bin.zip | ||
zipStoreBase=GRADLE_USER_HOME | ||
zipStorePath=wrapper/dists | ||
zipStoreBase=GRADLE_USER_HOME |
43 changes: 43 additions & 0 deletions
43
server/src/main/java/de/coronavirus/imis/SampleConfig.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
package de.coronavirus.imis; | ||
|
||
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.boot.context.properties.EnableConfigurationProperties; | ||
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; | ||
|
||
@Configuration | ||
@EnableConfigurationProperties | ||
public class SampleConfig { | ||
@Bean | ||
public ServletWebServerFactory servletContainer() { | ||
TomcatServletWebServerFactory tomcat = new TomcatServletWebServerFactory() { | ||
@Override | ||
protected void postProcessContext(Context context) { | ||
SecurityConstraint securityConstraint = new SecurityConstraint(); | ||
securityConstraint.setUserConstraint("CONFIDENTIAL"); | ||
SecurityCollection collection = new SecurityCollection(); | ||
collection.addPattern("/*"); | ||
securityConstraint.addCollection(collection); | ||
context.addConstraint(securityConstraint); | ||
} | ||
}; | ||
tomcat.addAdditionalTomcatConnectors(redirectConnector()); | ||
return tomcat; | ||
} | ||
|
||
private Connector redirectConnector() { | ||
Connector connector = new Connector( | ||
TomcatServletWebServerFactory.DEFAULT_PROTOCOL); | ||
connector.setScheme("http"); | ||
connector.setPort(8080); | ||
connector.setSecure(false); | ||
connector.setRedirectPort(8443); | ||
return connector; | ||
} | ||
} | ||
|