Skip to content

A simple project to demonstrate micro-service architecture using Spring, and adding security using Keycloak with a simple client interface using Angular

Notifications You must be signed in to change notification settings

Anass-Bricha/Micro-services-architecture-demo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 

Repository files navigation

Ecom App To demonstrate micro-service architecture + Security with Keycloak + Front with Angular

Keycloak 20.0.2

  • Command to start keycloak in the memory database (For windows): kc.sh start-dev --storage=chm
  • Command to start Consul: consul agent -server -bootstrap-expect=1 -data-dir=consul-data -ui -bind=your-ip-address

Serivces

> Configuration service :

> To initiate the configuration service, we need these depensencies :

image

  • After, we need to create a local or repository, and create our confiuration files, then commit them to the repository image
  • To activate any new updates made to any configuration, we need first to commit the changes, then send a post request to : http://localhsot:port/actuator/refresh to activate them.

> Gateway service :

> To initiate the gateway service, we need the depensencies :

image

  • Then, add the properties in application.yaml to configure the service and import the configuration for the configuration service : image

> Registration service :

Security

We are using to secure our app keycloak adapter.

NOTE : we added security to one service (Customer service) just for demonstration

> Security Configuration :

> Keycloak configuration :

  • To launch keycloak locally, after downloading the zip file, you need to open the bin folder inside the keycloak folder, then launch the command above to start keycloak using memory storage.
  • After launching, open keycloak on http://localhost:8080 image image
  • After creating the account, login to the keycloak image

> Realm Configuration

image

> Clients Configuration

image

> Users Configuration

image

> Users/Roles Mapping

image image image

> Before we start configuring keycloak on spring boot, we need first the dependencies :

image

* And we need to add keycloak adapter :

image

> Keycloak adapter configuration

  • Keycloak uses keycloakAuthenticationProvider that implements AuthenticationProvider image

• Keycloak uses a configuration file keycloak.json , and to use application properties to set keycloak configuration properties,we need to add the following Bean:

• Keycloak properties in application.yml

About

A simple project to demonstrate micro-service architecture using Spring, and adding security using Keycloak with a simple client interface using Angular

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published