|
@@ -2,10 +2,6 @@ package org.maxkey;
|
|
|
|
|
|
import java.util.ArrayList;
|
|
|
import java.util.List;
|
|
|
-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.maxkey.authn.realm.jdbc.JdbcAuthenticationRealm;
|
|
|
import org.maxkey.authn.realm.ldap.LdapAuthenticationRealm;
|
|
|
import org.maxkey.authn.realm.ldap.LdapServer;
|
|
@@ -31,7 +27,6 @@ import org.slf4j.Logger;
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
import org.springframework.beans.factory.InitializingBean;
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
|
-import org.springframework.boot.web.embedded.tomcat.TomcatServletWebServerFactory;
|
|
|
import org.springframework.boot.web.servlet.FilterRegistrationBean;
|
|
|
import org.springframework.context.annotation.Bean;
|
|
|
import org.springframework.context.annotation.ComponentScan;
|
|
@@ -77,35 +72,7 @@ public class MaxKeyConfig implements InitializingBean {
|
|
|
registration.setOrder(1);
|
|
|
return registration;
|
|
|
}
|
|
|
-
|
|
|
- @Bean
|
|
|
- public Connector connector() {
|
|
|
- Connector connector = new Connector("org.apache.coyote.http11.Http11NioProtocol");
|
|
|
- connector.setScheme("http");
|
|
|
- connector.setPort(80);
|
|
|
- connector.setSecure(false);
|
|
|
- connector.setRedirectPort(443);
|
|
|
- return connector;
|
|
|
- }
|
|
|
-
|
|
|
- @Bean
|
|
|
- public TomcatServletWebServerFactory tomcatServletWebServerFactory(Connector connector) {
|
|
|
- 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(connector);
|
|
|
- return tomcat;
|
|
|
- }
|
|
|
|
|
|
-
|
|
|
@Bean(name = "keyUriFormat")
|
|
|
public KeyUriFormat keyUriFormat(
|
|
|
@Value("${config.otp.keyuri.format.type:totp}")
|