Just a pet project i’m doing at home now that i’ve mostly locked myself indoors. Having said that, i’m trying to put it together with all the bells and whistles, mostly so i can learn some new stuff. I had implemented version 1 of this back in 2015, and it has been running like a champ on my raspberryPi for over 5 years now.
For the updated version (Angular 9/.net core 3.1), I’m thinking of using Auth0 as my auth provider (however i’m also considering using AWS Cognito). I’ve identified microservice boundaries for the app, and will be using RabbitMQ for inter-service messaging whenever possible.However there are a number of scenarios where one MS will need to get data from another MS to complete a request. Essentially something which in a monolith would have been a DB join. I did some reading on this over the weekend, and found that you can do that join on the front-end, in the API gateway, or by having MS A perform a REST query to MS B. The first feels a bit silly, because then the browser has to perform multiple requests and the second will require me to build a gateway (I was just planning on using NGINX as a reverse proxy). So I settled on the third option... REST requests from MS A to MS B.
My question...
How do you handle security when having inter-service communication?Options which I’ve considered, in order of ease:
- Forward the Auth header from MS A to MS B when making the request
- Host an internal instance of MS B which isn’t exposed to the internet via the reverse proxy, and only exposes functionality which will be needed in cross microservice communication. (Not sure if that explanation makes sense)
- Have MS A request it’s own token from the auth provider (Auth0, AWS Cognito, etc.) and call MS B with that token.
Is there a standard way of doing this?