Architecture – User authorization with microservices

Architectureauthorizationmicroservices

Should microservices be responsible for handling their own authorization or you think it's better to have a separate authorization service that is shared across all or a subset (within the same business domain) of microservices?

To me the latter makes more sense as it makes it easier to apply changes, enforce policies; it is DRY etc. However it can easily get out of hand by all sorts of services dumping their rules into one place, and also concerned about the network overhead.

Any thoughts?

Best Answer

I would use a central, unified authentication system and have separate permissions/stats for each microservice (sort of like how I can't yet upvote on this stack exchange site but I can in stack overflow while using the central stack exchange authentication system). One of my current projects will involve this approach in the near future, which will be nice; the previous development work involved creating a HIPPA compliant system, necessitating a second level of authorization/authentication, and it is a time consuming annoyance to daisy chain authorizations from legally separate but functionally inseparable components of the system. The debugging process involves a lot less joy than a simple oauth login or an api with appid and x-auth headers.

Which to use depends upon the specific requirements of a development roadmap, but I would choose the simpler approach where possible to avoid excessive overhead and development time/effort.

Related Topic