|
@@ -1,72 +0,0 @@
|
|
|
-package com.om.config;
|
|
|
-
|
|
|
-import org.apache.catalina.connector.Connector;
|
|
|
-import org.apache.coyote.http11.Http11NioProtocol;
|
|
|
-import org.springframework.beans.factory.annotation.Value;
|
|
|
-import org.springframework.boot.web.embedded.tomcat.TomcatServletWebServerFactory;
|
|
|
-import org.springframework.context.annotation.Bean;
|
|
|
-import org.springframework.context.annotation.Configuration;
|
|
|
-
|
|
|
-@Configuration
|
|
|
-public class AndroidSslConfiguration {
|
|
|
-
|
|
|
- @Value("${android.ssl.key-store}")
|
|
|
- private String keyStore;
|
|
|
-
|
|
|
- @Value("${android.ssl.key-store-password}")
|
|
|
- private String keyStorePassword;
|
|
|
-
|
|
|
- @Value("${android.ssl.keyStoreType}")
|
|
|
- private String keyStoreType;
|
|
|
-
|
|
|
- @Value("${android.ssl.keyAlias}")
|
|
|
- private String keyAlias;
|
|
|
-
|
|
|
- @Value("${android.ssl.client-auth}")
|
|
|
- private String clientAuth;
|
|
|
-
|
|
|
-
|
|
|
- @Value("${android.ssl.trust-store}")
|
|
|
- private String trustStore;
|
|
|
-
|
|
|
- @Value("${android.ssl.trust-store-password}")
|
|
|
- private String trustStorePassword;
|
|
|
-
|
|
|
- @Value("${android.ssl.trust-store-type}")
|
|
|
- private String trustStoreType;
|
|
|
-
|
|
|
- @Value("${android.ssl.trust-store-provider}")
|
|
|
- private String trustStoreProvider;
|
|
|
-
|
|
|
- @Value("${android.server.port}")
|
|
|
- private int androidPort;
|
|
|
-
|
|
|
- @Bean
|
|
|
- public TomcatServletWebServerFactory servletContainer() {
|
|
|
- TomcatServletWebServerFactory tomcat = new TomcatServletWebServerFactory();
|
|
|
- tomcat.addAdditionalTomcatConnectors(createSslConnector());
|
|
|
- return tomcat;
|
|
|
- }
|
|
|
-
|
|
|
- private Connector createSslConnector() {
|
|
|
- Connector connector = new Connector(Http11NioProtocol.class.getName());
|
|
|
- Http11NioProtocol protocol = (Http11NioProtocol) connector.getProtocolHandler();
|
|
|
- try {
|
|
|
- connector.setScheme("https");
|
|
|
- connector.setPort(androidPort);
|
|
|
- protocol.setKeystoreFile(keyStore);
|
|
|
- protocol.setKeystorePass(keyStorePassword);
|
|
|
- protocol.setKeystoreType(keyStoreType);
|
|
|
- protocol.setKeyAlias(keyAlias);
|
|
|
-
|
|
|
- protocol.setTruststoreFile(trustStore);
|
|
|
- protocol.setTruststorePass(trustStorePassword);
|
|
|
- protocol.setTruststoreType(trustStoreType);
|
|
|
- protocol.setTruststoreProvider(trustStoreProvider);
|
|
|
- // protocol.setClientAuth(clientAuth);
|
|
|
- } catch (Exception ex) {
|
|
|
- throw new IllegalStateException("Failed to create SSL connector", ex);
|
|
|
- }
|
|
|
- return connector;
|
|
|
- }
|
|
|
-}
|