Skip to content

The simplest way to enable HTTPS in your spring-boot application.

License

Notifications You must be signed in to change notification settings

yugzan/spring-boot-https-kit

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Spring Boot HTTPS Kit

Import this library to get HTTPS capability for your spring-boot application.

Build

If you don't want to test with your keystore, run ./gradlew clean build -x test to exclude tests. Otherwise, configure keystore proeprties in src/test/resources/application.yml and execute ./gradlew clean build.

The output folder is build/libs.

Getting Started

Import the library and enable component scan @ComponentScan("org.ycavatars.sboot.kit"), provide your keystore and configure these properties via these ways.

  • connector.https.enabled
  • connector.https.keystoreFile
  • connector.https.keystorePass
  • connector.https.keyAlias

Keytool

If you don't know how to generate a keystore, read this section.

You have to generates a key pair (a public key and associated private key) to enable HTTPS. Before you begin, it might be better for you to read these documents: keytool - Key and Certificate Management Tool ,Use keytool to Create a Server Certificate and SSLConnectionSocketFactory java doc.

Example

keytool -genkeypair -alias <keyAlias> -keyalg RSA -keystore <keystoreFile>.p12 -storepass <keystorePass> -validity 3650 -keysize 2048 -dname "CN=<hostname>"

Specify your own , and , and set them to connector.attribute.keyAlias, connector.attribute.keystoreFile and connector.attribute.keystorePass. means the host which runs your server. If you forget to set , your client will have issues like SSLHandshakeException.

Note that each certificate is valid for 10 years in this example (-validity 3650). Remember to change them depends on your needs.

About

The simplest way to enable HTTPS in your spring-boot application.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Java 100.0%