Added server-side additional code to support HTTPS protocol with self-signed cert

This commit is contained in:
Zhongheng Liu 2024-02-18 16:37:12 +02:00
commit db4308dd29
No known key found for this signature in database
4 changed files with 25 additions and 1 deletions

14
pom.xml
View file

@ -50,7 +50,19 @@
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-websocket</artifactId>
</dependency>
</dependencies>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpcore</artifactId>
<version>4.4.11</version>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<version>4.5.9</version>
</dependency>
</dependencies>
<build>
<plugins>

View file

@ -1,10 +1,14 @@
package me.imsonmia.epqapi;
import javax.net.ssl.SSLContext;
import org.apache.tomcat.jni.SSL;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.Bean;
import org.springframework.web.client.RestTemplate;
import org.springframework.web.servlet.config.annotation.CorsRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

View file

@ -13,3 +13,11 @@ spring.jpa.show-sql: true
# validate for semi-production
# none for serious prod scenarios
spring.jpa.hibernate.ddl-auto=update
server.ssl.key-store-type=PKCS12
server.ssl.key-store=classpath:key/cert.p12
server.ssl.key-store-password=epqchat
server.ssl.enabled=true
trust.store=classpath:key/cert.p12
trust.store.password=epqchat

Binary file not shown.