Giter Site home page Giter Site logo

leaosomogyi / poc-ocelot Goto Github PK

View Code? Open in Web Editor NEW
5.0 2.0 0.0 59 KB

POC using Ocelot as API Gateway

C# 90.37% Dockerfile 9.63%
ocelot-gateway webapi jwt-authentication jwt-token docker ocelot api-gateway poc-ocelot docker-compose authentication

poc-ocelot's Introduction

POC Ocelot

This project intends to be used as an example of architecture with microservices and a Gateway API using Ocelot to achieve that.

Updated to .NET 6.0 and Ocelot 18.0.0.

Give a star on Ocelot Github to support the developers!

Getting Started

git clone https://github.com/LeaoSomogyi/poc-ocelot.git

Project Architecture

This solution has five projects, only Poc.Ocelot.Gateway has exposed on docker network and this project knows how to redirect requests to another services.

This routes configurations can be found on ocelot.json file.

Take a look at the diagram:

Untitled Diagram drawio (1)

Postman

Import Poc Ocelot.postman_collection.json to Postman and follow the requests order.

0 - Auth

Service called: Poc.Ocelot.Accounts

Only request with anonymous allowed. Used to get JWT token. If you pass the permission_claim query param, your can change if this token returned can access Backoffice API's or not. Possible values for this query param: Common or Backoffice.

1 - Product List

Service called: Poc.Ocelot.Products

Just a simple get returning a message, but only requests authenticated can access. Note the authentication is provided by Gateway, none configuration is made on the project.

2 - Payment List

Service called: Poc.Ocelot.Payments

Just a simple get returning a message, but only requests authenticated can access. Note the authentication is provided by Gateway, none configuration is made on the project.

3 - Backoffice Orders

Service called: Poc.Ocelot.Backoffice

This project has your own authentication rule. Only tokens with permission claim with the value Backoffice can access this request, otherwise and status 403 is returned.

Docker

On the root folder of the solution, just run the follow command to the magic begins:

docker-compose build

Once the build was finished:

docker-compose up

To run and force build:

docker-compose up --build

Authors

Check all contributors contributors

poc-ocelot's People

Contributors

dependabot[bot] avatar leaosomogyi avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

poc-ocelot's Issues

Can you to add Claims support to your example?

Hi, thank you for your work. I am want to use your solution for my task. Can you to help me and other users? Please

  1. convert example to .Net 6 and latest Ocelot version 12
  2. can you prepare example with claim base authorization. For example i am want to use [Authorize("MyPolice")] attribute for some controller actions
    I think with very hepled many peoples

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.