Posts

Showing posts with the label Spring Boot

Vault Cubbyhole authentication and its integration with Spring framework

  1. Background For micro service, it's essential not to bundle secrets into our code base, but to move them to an external central managed secrets store.  In this article, I'm going to introduce how to use  HashiCorp’s Vault  to externalize JAVA Spring micro service application configurations. With Vault you have a central place to manage external secret properties for applications across all environments. There are multiple authentication methods from Vault, but most of them are not suitable for Spring micro service, or not safe enough. When the application starts up I want all the properties to be automatically loaded into Spring context without interaction with human, so that the secrets can be used just like they are loaded from Spring's properties. The solution is to use single-use Vault Cubbyhole wrapping token to deliver the original token to the application. 2. Vault server We simply use docker compose to set up a Vault server. docker-compose.yml: version: '...

Build J2EE micro services architecture by using Spring Boot, Spring Cloud, Spring Security OAuth2, KeyCloak

Image
I posted an  article  in regards to single page application(UI), but in this post I'm going to introduce how to build micro service architecture for J2EE application with Spring framework and open source SSO framework  Keycloak . This post will cover the following aspects: Keycloak setup Eureka service registration and discovery Spring Cloud API gateway Spring Security (OAuth2 login) and the integration with Keycloak Micro services The code is available in my Github and please check the docker-compose.yml at first so that you can read the rest of the post easier. One thing I need to mention here is you need to replace the ip address of keycloak server url with your own before running the docker containers. YAML   1 version : '3.4' 2 services : 3 api-gateway : 4   build : 5     context : ./api-gateway 6   ports : 7     - "8080:8080" 8   restart : on-failure 9   environment : 10       #overriding spr...