commit e43b1727d2144167020701be10481db8e0e29332 parent 650ca1d9600c5dba9b4312efcbb53f76fc74fbf2 Author: Wim Dupont <wim@wimdupont.com> Date: Mon, 18 Apr 2022 13:10:51 +0200 removed ssl config Former-commit-id: 7e2b00f62edb8e2d5c5d30ca24322025754e3ab4 Diffstat:
M | src/main/java/com/wimdupont/personalweb/config/SecurityConfig.java | | | 5 | +---- |
D | src/main/java/com/wimdupont/personalweb/config/ServerConfig.java | | | 41 | ----------------------------------------- |
2 files changed, 1 insertion(+), 45 deletions(-)
diff --git a/src/main/java/com/wimdupont/personalweb/config/SecurityConfig.java b/src/main/java/com/wimdupont/personalweb/config/SecurityConfig.java @@ -12,9 +12,6 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter { @Override protected void configure(HttpSecurity http) throws Exception { - http - .requiresChannel() - .anyRequest() - .requiresSecure(); + http.formLogin().disable(); } } diff --git a/src/main/java/com/wimdupont/personalweb/config/ServerConfig.java b/src/main/java/com/wimdupont/personalweb/config/ServerConfig.java @@ -1,41 +0,0 @@ -package com.wimdupont.personalweb.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.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 -@SuppressWarnings("unused") -public class ServerConfig { - - @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(getHttpConnector()); - return tomcat; - } - - private Connector getHttpConnector() { - Connector connector = new Connector(TomcatServletWebServerFactory.DEFAULT_PROTOCOL); - connector.setScheme("http"); - connector.setPort(8081); - connector.setSecure(false); - connector.setRedirectPort(8443); - return connector; - } -}