How to check for user roles? #852
Unanswered
danechitoaie
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I have a lot of endpoints in Poem OpenAPI and In some I need to check if the current user is an admin, or manager.
At the moment I have same code copy & pasted in all the functions that does this check.
Another idea was to perform this check in the SecurityScheme and have different schemes JWTAdminSecurityScheme/JWTManagerSecurityScheme/JWTUserSecurityScheme/etc. which might work but then in the open api spic it appears like how I would use 3 types of auth which in reality it's just one but checks for different roles.
I also tried writing a proc macro that would inject the few lines of code that does this check into each endpoint but it's too difficult to do at the moment.
Any better idea to handle this?
Beta Was this translation helpful? Give feedback.
All reactions