I have multiple micro-services. which can be called by client through API gateway and also micro-services can communicate each other.
Ideally request will come from API gateway from user which will have all permissions. here i am trying to assign only required role to user for example if user(browser) need data from micro-service A then only that role will be given to user and if internally micro-service A needs data from B(rest call) then that role should not be assigned to user.
Requirement: how to restrict/authorize internal communication between micro-services so that only authorized micro-service can make call to others.
Options:
Assign all roles to user, even for internal communication(passing same token in all communications).
Assign only user facing micro-services role to user if internal communication is require then each micro-services will act as a user itself to other micro-service and generate there own token before call.
- Do not allow micro-service to communicate internally rather fetch all data from all micro-services and process at client.
What option will be best using above or any other?