What is the best practice for managing Authorization with APISIX Gateway and personal User Management Service? #13011
Replies: 1 comment
-
|
Hi @pamudyaputra! I'm Dosu and I’m helping the apisix team. Great question! You actually don't need to build a custom Lua plugin — APISIX has built-in plugins that can handle your use case. Based on your design, here are better alternatives: Recommended:
|
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi, I am currently in the middle of building a custom plugin to support my Authorization needs because as far as I searched, currently there is no built-in plugin available to support this. At my current level (a Junior Backend Engineer), I solely rely on ChatGPT in doing my research. In case anybody has similar use case as mine, what is the solution that you believe to be best in this case?
Context:
I have a User Management Service that manages users data and also the permissions, basically all business process related to user. In my case, I have a User-Role-Features relationship to manage access control. This feature is what I used to control users access by endpoint. For example, I have a feature named "READ_USER", this feature is mapped to GET /user endpoint. A user is given a role, which each roles have a set of features (configurable).
I am building a system with microservice architecture, and I chose APISIX as my API Gateway solution due to some considerations that I did. To achieve the "best-practice" of microservice architecture, I can only store users data in User Management Service which also acts as the single source of truth of user's access policy. I have successfully implemented Authentication centralized in the APISIX by using openid-connect plugin + JWKS connected to my User Management Service. With this approach, my downstream services won't need to do authentication anymore and can focus to process the business logics. To secure my downstream services, I also set up mTLS between APISIX and my upstreams.
Challenges occur when I try to centralize Authorization in the Gateway as well (endpoint level AuthZ, not including attribute level AuthZ). I created a design of the Authorization workflow and my supervisor approved it. But after doing my research, I can't find any built-in plugin to support this implementation. That's why I chose to try building my own Authorization plugin. But in the middle of the process, I face some challenges since I mostly develop with Java and have no experience with Lua. Before I continue my journey on building the plugin, I am curious is there better alternative for implementing Authorization in microservice architecture and APISIX as the Gateway?
This is my design of the AuthZ workflow:


This is my custom plugin flowchrat:
Beta Was this translation helpful? Give feedback.
All reactions