fastapi-auth-middleware
fastapi-auth-middleware copied to clipboard
EndPoint requires x or y scope
there are user with admin role, manager role and operator role, some endpoint are accessible if user is admin or manager which different response and other endpoint are exclusively for manager role however the admin can also access it.
poweruser endpoint is a condition were user has x and y roles and there is not a condition where @requires("admin" or "poweruser") can access with either user have x scope or y scope.
@app.get('/poweruser') # Sample endpoint (secured)
@requires(["admin", "poweruser"]) # Requires the roles 'admin' and 'poweruser' (Will fail)
def poweruser(request: Request):
return request.user # Returns the user object that is injected into the request. The FastAPIUser in this case
can it have a develope for it please.