Prasad Parab
Prasad Parab

Reputation: 496

API gateway role in micro services security

I'm new to microservices and system design, and I'm trying to understand the role of the API Gateway in authentication and authorization.

I've come across two different approaches, each with its pros and cons:

1. API Gateway Handles Authorization

In this approach, the API Gateway:

Pros:

Cons:

2. Each Microservice Handles Authorization

Here, each microservice:

Pros:

Cons:

Question

Which approach is more widely adopted in the industry, and what factors should be considered when choosing between these models?

Upvotes: 0

Views: 22

Answers (1)

Rob Conklin
Rob Conklin

Reputation: 9446

This is more robustly answered here: Microservice authorization pattern with api gateway, but in general you really want to couple your authorization in your service-layer, otherwise you will quickly create a "god-object" anti-pattern in your gateway. It will very quickly violate Single Responsibility Principal when your gateway has deep knowledge of the inner workings of all the services that it fronts.

Upvotes: 0

Related Questions