Skip to content

Demo integration between Vault and a sample Java application using the Spring Cloud Vault library

License

MPL-2.0, MPL-2.0 licenses found

Licenses found

MPL-2.0
LICENSE
MPL-2.0
LICENSE.md
Notifications You must be signed in to change notification settings

nicklhw/vault-java-app-demo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Vault Java App Demo

This repo demonstrates the integration between Vault and a sample Java application using the Spring Cloud Vault library.

  • demo-app is a Spring Boot application that exposes a REST API.
    • The app authenticates to Vault using AppRole auth method
    • The app calls Vault to retrieve static KV secrets, encrypt and decrypt data using the transit secrets engine, and get dynamic database credentials to connect to MySQL database.
    • The app uses the Spring Cloud Vault library to integrate with the Vault API.
  • On the Vault server side 3 secrets engines are enabled: database, KV, and transit
    • The database secrets engine integrates with MySQL to generate dynamic DB credentials for the demo-app
    • The transit secrets engine is used for encrypting and decrypting application data
  • Sample Postman collection included

Prerequisites

Run

# export Vault license
export VAULT_LICENSE=$(cat ~/Downloads/vault.hclic)     

# Start all containers
make all

# Login to Vault as admin
export VAULT_ADDR=http://localhost:8200
vault login --method=userpass username=admin password=passw0rd

Useful commands

# login to mysql and show table schema
docker exec -it mysql sh
mysql -uroot -ppassw0rd
use demo;
describe orders;

# build demo-api spring boot app
make build-api

# run demo-api spring boot app locally
make run-api

# build demo-api app docker image
make build-docker-api

Reference

About

Demo integration between Vault and a sample Java application using the Spring Cloud Vault library

Resources

License

MPL-2.0, MPL-2.0 licenses found

Licenses found

MPL-2.0
LICENSE
MPL-2.0
LICENSE.md

Stars

Watchers

Forks

Packages

No packages published