Working with SSL bundles
spring-addons-starter-rest integrates with Spring Boot SSL bundles (introduced in Boot 3.1). Lets consider the following Boot configurations for SSL with self signed certificates generated with openssl req -x509 -newkey rsa:4096 -keyout tls.key -out tls.crt -sha256 -days 3650 -passout pass:change-me -subj "/C=PY/ST=Tahiti/L=Papeete/CN=localhost/emailAddress=ch4mp@c4-soft.com":
- on the consumed REST API:
server: port: 8081 ssl: bundle: server spring: ssl: bundle: pem: server: keystore: certificate: classpath:tls.crt private-key: classpath:tls.key private-key-password: change-me - on the service using a REST client to call the service above:
spring: ssl: bundle: pem: client: truststore: certificate: classpath:tls.crt com: c4-soft: springaddons: rest: client: machin-client: base-url: https://localhost:8081 ssl-bundle: clientIn the configuration above:
- the same (self-signed) certificate is used to configure the
serverbundle on the consumed service, and theclientbundle on the consuming side. - the
serverSSL bundle is referenced in theserver.ssl.bundleconfiguration of the consumed service - the
clientSSL bundle is referenced in thecom.c4-soft.springaddons.rest.clientconfiguration of the consuming service