Replies: 1 comment
-
Yes, that could be done "manually" using the def has_permission(access_token_info: FiefAccessTokenInfo, permission: str) -> bool:
return permission in access_token_info["permissions"]
@app.post('/api/create-castle')
async def create_castle(
request: Request,
access_token_info: FiefAccessTokenInfo = Depends(auth.authenticated())
):
... If you also need the |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Is it possible to perform authorization check (for an authenticated user) inside the path operation function?
Example:
Suppose we have Fief service with two permissions:
createCastle
andcreateSimpleCastle
and a service capable of creating both types of castles. Is it possible to do something like this?How could
hasPermission
function look like?The reason for that is to have a single path in API and a single path operation function in source code.
Beta Was this translation helpful? Give feedback.
All reactions