This project is used to demonstrate a few things.
- How to secure SpringBoot application with SSL
- How to generate a
Self Signed Certificate
- How to add said certificate to Chrome so that
Cypress
can run tests on it.
- Start up the SSL secured api by executing
mvn spring-boot:run
inapi
folder - Check that you can access
https://localhost:8443
using Chrome (Warning will be presented) - Add
ssl-server.jks
Self Signed Certificate to chrome as Trusted Root Certificate. Chrome > settings > Manage Certificates > Trusted Root Certificate Authorities > import - Restart Chrome and Check
https://localhost:8443
again. The warning should be gone. - Go to
e2e
folder and executenpm run open
and selectssl-demo.spec.js
test.
Java Keytools
andOpenSSL
are different cli that can be used to generate SSL certificates- Self Signed Certificates can be added to Chrome's
Trusted Root Certificate
so that warnings do not occur - When generating Self Signed Certs, remember to include Subject Alternative Name (SAN) in order to to prevent
err_cert_common_name_invalid
error.SAN
in our case would belocalhost
- Truststore is used for public certificates while Keystores is used for private ones (JKS stands for Java KeyStore)
- A keystore can store multiple certificates. a
.jks
file is a keystore, not a certificate - While it's possible to redirect all
HTTP
requests toHTTPS
programatically, it can also be done via Domain Provider like GoDaddy.
- How to secure SpringBoot application with SSL -
Java Keytool
is used to generate - Difference between Self-Signed Certificate and CA Signed SSL Certificate
- Difference between Trusted Root and Intermediate CA
-genkey -alias selfsigned_localhost_cert -keyalg RSA -keysize 2048 -validity 3650 -keypass changeit -keystore ssl-server.jks -ext san=dns:localhost