Skip to Content
Mastering Spring Cloud
book

Mastering Spring Cloud

by Piotr Mińkowski
April 2018
Intermediate to advanced content levelIntermediate to advanced
432 pages
10h 38m
English
Packt Publishing
Content preview from Mastering Spring Cloud

Registering a secure service

Securing the server side is one thing; registering a secure application is something else. Let's look at how we can do this:

  1. To enable SSL for a Spring Boot application, we need to start with generating a self-signed certificate. I recommend you use keytool for that, which is available under your JRE root in the bin catalog:
keytool -genkey -alias client -storetype PKCS12 -keyalg RSA -keysize 2048 -keystore keystore.p12 -validity 3650
  1. Enter the required data and copy the generated keystore file keystore.p12 to your application's src/main/resources catalog. The next step is to enable HTTPS for Spring Boot using configuration properties in application.yml:
server:  port: ${PORT:8081} ssl: key-store: classpath:keystore.p12 ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Microservices with Spring Boot and Spring Cloud - Second Edition

Microservices with Spring Boot and Spring Cloud - Second Edition

Magnus Larsson

Publisher Resources

ISBN: 9781788475433Supplemental Content