Skip to content

Latest commit

 

History

History
59 lines (44 loc) · 1.66 KB

README.md

File metadata and controls

59 lines (44 loc) · 1.66 KB

store-application CircleCI

Template project with Spring Cloud starters.

  • Spring Boot 2.0.6
  • Spring Cloud (Finchley.SR2)
  • Spring Cloud Oauth 2
  • Spring Cloud Eureka Service Discovery
  • Spring Cloud Config Server
  • Spring Cloud Zuul API Gateway
  • Docker
  • PostgresSQL

Project structure

  • store-auth-service (Oauth2 authorization server )
  • store-config-service (Distributed configuration server)
  • store-eureka-service (Service discovery server)
  • store-gateway-service (API Gateway server)
  • store-product-service (Oauth2 resource server for product domain)

Build Projects

From project directory, run maven clean install.

mvn clean install

Run the Application

From project directory, start up the application by running.

docker-compose up -d --build

Compose pulls and build the images from project, and starts the services and databases.

picture

Authentication

To request a token, the client must be registered on the authorization server and must send the client-id and the secret that we configured in the application.yml encoded in the Base 64.

POST /oauth/token?grant_type=password&username=jhon@gmail.com&password=123456 HTTP/1.1
Host: localhost:9092
Authorization: Basic Y2xpZW50OjEyMw==
Content-Type: application/json
Cache-Control: no-cache
Postman-Token: adf4750e-4429-e983-9550-0c0523260e86

Authorization

We have a two types of roles.

ROLE_ADMIN
ROLE_USER