Hello everone,
I am setting up a Keycloak + APISIX system to manage authentication and authorization for microservices. I would like to seek advice from experienced professionals on best practices for the following questions:
Should authorization be managed using Realms or Group/User Roles?
- I have multiple user groups, each with different permissions for various APIs.
- Should I create multiple separate Realms, or is it better to use a single Realm with Group/User Roles for better permission management?
- In a multi-tenant system, which approach is more optimal?
Should authorization be enforced at APISIX or within each microservice?
- APISIX can validate JWT tokens for user authentication, but should I decode the JWT and check
role_name
directly within each microservice instead? - In which cases should APISIX handle role verification before forwarding the request to the service?
- When is it better to let microservices handle authorization for greater flexibility?
- What are the risks or limitations of using APISIX as the authorization layer?
I have searched through many posts but haven’t found one that discusses best practices for this type of implementation, or if there is one, it doesn’t provide a proposed solution.
I sincerely appreciate any advice you can share, even if it’s just a little. Thank you so much!
Same topic: