I was reading a lot regarding authentication in a microservices architecture, and I end up with the conclusion that JWS security is the way to go. That means
- When the client makes a request, it needs to have a valid access token
- The authentication of the requests is happening at the gateway level, the authorization at the microservice application level
- When the client makes a request to microservice A, and I need to call microservice B, I need to re-use the same access token to make the requests to A and B.
But I still have a lot of doubts when the originator of the request is not a client, and it's another application, from outside the microservice architecture and from inside
If we have a monolithic application and we want to call a microservice, we are planning to develop a light way authentication model with an API-Key that is going to be translated to a JWS at the gateway level. So the application doesn't need to maintain a session (with tokens and refresh tokens) and can make requests just using an API-Key, but at the gateway level that API-Key would be translated into a JWS, so everything inside the microservices architecture would be using JWS as the authorization model.
But what if we want to communicate the microservice A with microservice B, and the one that originates the call is microservice A. That means application to application in the same microservices architecture. Here are my doubts:
- If I follow the same logic explained above, I would need to pass through the gateway to translate the API-Key to a JWS just to communicate two microservices and it doesn't make sense.
- The communication between microservices inside the same architecture, needs to be authenticated/authorized? We are using Istio for mutual TLS
- It's the API-Key a good idea for app-to-app authentication? Or it's just better to use JWS for everything?
- If the way to go is another totally different authentication/authorization model. Does that mean that the applications need to support both models? (That would increase the complexity of all the microservices)
This topic confuses me, so any help regarding this subject is more than welcome