|
|
@ -2,11 +2,13 @@ package kr.xit.core.spring.config.support;
|
|
|
|
|
|
|
|
|
|
|
|
import java.security.cert.CertificateException;
|
|
|
|
import java.security.cert.CertificateException;
|
|
|
|
import java.security.cert.X509Certificate;
|
|
|
|
import java.security.cert.X509Certificate;
|
|
|
|
|
|
|
|
|
|
|
|
import javax.net.ssl.HostnameVerifier;
|
|
|
|
import javax.net.ssl.HostnameVerifier;
|
|
|
|
import javax.net.ssl.HttpsURLConnection;
|
|
|
|
import javax.net.ssl.HttpsURLConnection;
|
|
|
|
import javax.net.ssl.SSLContext;
|
|
|
|
import javax.net.ssl.SSLContext;
|
|
|
|
import javax.net.ssl.TrustManager;
|
|
|
|
import javax.net.ssl.TrustManager;
|
|
|
|
import javax.net.ssl.X509TrustManager;
|
|
|
|
import javax.net.ssl.X509TrustManager;
|
|
|
|
|
|
|
|
|
|
|
|
import org.apache.catalina.Context;
|
|
|
|
import org.apache.catalina.Context;
|
|
|
|
import org.apache.catalina.connector.Connector;
|
|
|
|
import org.apache.catalina.connector.Connector;
|
|
|
|
import org.apache.tomcat.util.descriptor.web.SecurityCollection;
|
|
|
|
import org.apache.tomcat.util.descriptor.web.SecurityCollection;
|
|
|
@ -38,15 +40,21 @@ import org.springframework.context.annotation.Configuration;
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* </pre>
|
|
|
|
* </pre>
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
@ConditionalOnProperty(value = "server.http")
|
|
|
|
@ConditionalOnProperty(value = "server.ssl.enabled", havingValue = "true", matchIfMissing = false)
|
|
|
|
@Configuration
|
|
|
|
@Configuration
|
|
|
|
public class HttpsConnectorConfig {
|
|
|
|
public class HttpsConnectorConfig {
|
|
|
|
@Value("${server.port}")
|
|
|
|
@Value("${server.port}")
|
|
|
|
private int SSL_PORT;
|
|
|
|
private int SERVER_PORT;
|
|
|
|
|
|
|
|
|
|
|
|
@Value("${server.http}")
|
|
|
|
@Value("${server.http}")
|
|
|
|
private int HTTP_PORT;
|
|
|
|
private int HTTP_PORT;
|
|
|
|
@Value("${server.ssl.redirect}")
|
|
|
|
|
|
|
|
|
|
|
|
@Value("${server.ssl.enabled:false}")
|
|
|
|
|
|
|
|
private boolean sslEnabled;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Value("${server.ssl.redirect:false}")
|
|
|
|
private boolean SSL_REDIRECT;
|
|
|
|
private boolean SSL_REDIRECT;
|
|
|
|
|
|
|
|
|
|
|
|
@Bean
|
|
|
|
@Bean
|
|
|
|
public ServletWebServerFactory servletContainer() {
|
|
|
|
public ServletWebServerFactory servletContainer() {
|
|
|
|
|
|
|
|
|
|
|
@ -80,8 +88,9 @@ public class HttpsConnectorConfig {
|
|
|
|
Connector connector = new Connector("org.apache.coyote.http11.Http11NioProtocol");
|
|
|
|
Connector connector = new Connector("org.apache.coyote.http11.Http11NioProtocol");
|
|
|
|
connector.setScheme("http");
|
|
|
|
connector.setScheme("http");
|
|
|
|
connector.setSecure(false);
|
|
|
|
connector.setSecure(false);
|
|
|
|
connector.setPort(HTTP_PORT);
|
|
|
|
if(sslEnabled) connector.setPort(HTTP_PORT);
|
|
|
|
if(SSL_REDIRECT) connector.setRedirectPort(SSL_PORT);
|
|
|
|
else connector.setPort(SERVER_PORT);
|
|
|
|
|
|
|
|
if(SSL_REDIRECT) connector.setRedirectPort(SERVER_PORT);
|
|
|
|
return connector;
|
|
|
|
return connector;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|