Authorizations in Microservices
When developing a monolithic application, managing authorizations and permissions is a bit easier since you have a single point of control for all authorizations and permissions. However, with the rise of microservices, this task becomes more complex.
In a microservices architecture, each service typically has its own database and logic for handling permissions. This can lead to duplication and inconsistency in how permissions are managed across services. Additionally, sharing permissions between services can become problematic.
One way to solve this issue is by using Authorization-as-a-Service π. This approach involves creating a separate service dedicated to managing all authorizations for the various services within your architecture. This centralizes control, ensuring consistency and simplifying the management of permissions across your microservices. π
Proof of Concept (POC) π
Today, I’ll do a quick proof of concept (POC) to explore authorization management. I’ll use an open-source solution that provides this functionality
there are plenty of options available.
Some of Open-Source solutions π οΈ
- perimfy
- openfga
- casbin
- topaz
Cloud solutions βοΈ
- there are good cloud solutions like Permit.io
For today’s POC, I’ll be using Permify. β
- Run the permify service on docker and expose HTTP and GRPC ports.
- Created a new tenant at permify to store our policies
- Created our schema, using the traditional RBAC model for simplicity π§. However, in real-world, complex applications, there are many models designed to handle complex use cases.
In fact, Permify is considered as fine-grained access control service, inspired by Googleβs Zanzibar
. π This allows for more detailed and flexible permission management, making it suitable for more complex scenarios.
Permify has a great article about their solution Here
- Attached roles to our users
- Created a simple nodejs services to test check user permissions using GRPC via permify sdk.
- Created a wrapper to check user permissions.
- Final Test