- Maven 3
- JDK 21
- Article Service with REST endpoints protected by certificate
- Facade Service with REST endpoints. Make calls to Article Service
mvn clean install
Use run_via_maven.bat
scripts in
articles-service and
facade-service folders
Use run_via_maven.bat
script in
articles-service folder and
run_via_maven-unsecure_calls.bat
script in
facade-service folder
docker-compose up
docker-compose up --build --force-recreate --no-deps
docker-compose down
Articles service Swagger page
Facade service Swagger page
curl -v \
--cacert _cert/issued-for-localhost/andd3dfx.crt \
--key _cert/issued-for-localhost/andd3dfx.key \
https://localhost:9082/api/v1/articles
If you got CERT_TRUST_IS_NOT_TIME_VALID
error - you need to generate new certificate instead of expired one.
curl -v --connect-to articles-service:9082:localhost:9082 \
--cacert _cert/issued-for-articles-service/andd3dfx.crt \
--key _cert/issued-for-articles-service/andd3dfx.key \
https://articles-service:9082/api/v1/articles
Used connect-to
flag of curl to satisfy cert condition CN=article-service
If you got CERT_TRUST_IS_NOT_TIME_VALID
error - you need to generate new certificate instead of expired one.
curl http://localhost:9081/api/v1/articles
Based on https://www.baeldung.com/spring-boot-https-self-signed-certificate
keytool -genkeypair -alias andd3dfx -keyalg RSA -keysize 2048 -storetype PKCS12 -keystore andd3dfx.p12 -validity 1825
Dialog during certificate generation:
Enter keystore password: andreika Re-enter new password: andreika What is your first and last name? [Unknown]: localhost What is the name of your organizational unit? [Unknown]: What is the name of your organization? [Unknown]: andrei-company What is the name of your City or Locality? [Unknown]: Minsk What is the name of your State or Province? [Unknown]: Minsk What is the two-letter country code for this unit? [Unknown]: BY Is CN=localhost, OU=andrei-dev, O=andrei-dev, L=Minsk, ST=Minsk, C=BY correct? [no]: yes
openssl pkcs12 -in andd3dfx.p12 -nocerts -out andd3dfx.key
(used andreika
as a password for all steps)
openssl pkcs12 -in andd3dfx.p12 -clcerts -nokeys -out andd3dfx.crt
(used andreika
as a password for all steps)