-
-
Notifications
You must be signed in to change notification settings - Fork 8.8k
Closed
Labels
Description
Is your feature request related to a problem? Please describe.
It is a useful addition to have access control over FastAPI. Some framework have builtin support and some can get this feature with a plugin.
Describe the solution you'd like
According to its docs, Casbin provides support for enforcing authorization based on various access control models.
Here is the function I image:
- Check permission before handle the request. Maybe implement is using a custom class APIRoute class.
- Sync FastAPI path operation with Casbin policy file (or policy storage adapter).
Maybe a function to execute on application startup; it gets all path operation's path, method and some other optional information like tags, user_id and user_role, then write it to Casbin policy file.
It cleans redundant row in Casbin policy file and keep it update with FastAPI routes. - Document to describe how to use it (with example code).
Reactions are currently unavailable