Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

When allowing (or not allowing) permissions with a token, what's a good way to ensure roles or permissions are set accordingly if the token doesn't exist? #28

Open
Adron opened this issue Mar 18, 2021 · 0 comments
Assignees
Labels
question Further information is requested

Comments

@Adron
Copy link
Contributor

Adron commented Mar 18, 2021

An app has the ability to disable users. When a user is disabled, I update the JWT claims to contain "X-Hasura-Enabled": false. However it seems difficult to craft permissions expressions to accept access if this claim either doesn't exist, or is set to true, and deny otherwise. I could change the X-Hasura-Role claim instead and not touch the permissions logic, but that seems more like a hack than a proper solution, as the claimed role won't match the actual role (the user's role hasn't changed, she's just disabled).

IMO it would be easier to update the user table instead of the token. and use the _exists in the permission https://hasura.io/docs/latest/graphql/core/auth/authorization/permission-rules.html#using-unrelated-tables-views (per leoalves)

@Adron Adron added the question Further information is requested label Mar 18, 2021
@Adron Adron self-assigned this Mar 18, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

1 participant