docs: explain allowed-roles/default-role in docs more clearly
See original GitHub issue-
Explain allowed-roles/default-role in docs more clearly, with the rationale for this design.
-
And why/how it is tricky/hard to do permission merging for multi-roles.
TL;DR for 1 - If you put the x-hasura-role
in the JWT then everytime the user has to change role you would have to issue a new JWT. Hence there is a list of allowed-roles (x-hasura-allowed-roles
) and a default role (x-hasura-default-role
). If no x-hasura-role
header is sent then the default role is picked. If a x-hasura-role
header is sent then it is validated with the allowed-roles in the JWT.
Issue Analytics
- State:
- Created 4 years ago
- Reactions:4
- Comments:5 (3 by maintainers)
Top Results From Across the Web
Zoom or change your document view - Google Support
In Google Docs, to make the document as wide as the browser window, click Fit. Change your view. On your computer, open a...
Read more >Google Docs: Online Document Editor | Google Workspace
Use Google Docs to create, and collaborate on online documents. Edit together with secure sharing in real-time and from any device.
Read more >21 Google Doc Features You Didn't Know Existed (But Totally ...
Google Docs Features · Add Fonts · Templates · Table of Contents Sidebar · Create or Remove Headers · Clear Formatting · Create...
Read more >Icons for Slides & Docs - Google Workspace Marketplace
Open the add on, Add-on > Icons for Slides & Docs > Start Search for Icons, and add Icons to your documents by...
Read more >Google Cloud documentation
Find guides, code samples, architectural diagrams, best practices, tutorials, API references, and more to learn how to build on Google Cloud. Get started....
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
x-hasura-default-role
&x-hasura-allowed-roles
, in the JWT claim, are the primary values that are used for permissions.x-hasura-default-role
is the role used for the query permissions and it’s value must be included inx-hasura-allowed-roles
. These values need to be defined in the JWT claim and the JWT mode needs to be configured in Hasura [docs].x-hasura-role
is actually the secondary or override value for role, which is used for role impersonation. It is defined in an HTTP Header, not in the JWT claim, so that the value can be easily changed in the header, without regenerating the JWT.In the example below the account has a
user
role and is able to use/impersonate anadmin
role. It’s like using sudo in Linux.JWT Claim
HTTP Header
x-hasura-role: user
If a JWT is used, session variables will only be read from the JWT claim, not from the HTTP headers (the only exception is
x-hasura-role
). In addition, ifclaims_map
is used in the configuring the JWT mode, session variables will only be populated from the mapped variables and not from theclaims_namespace
or theclaims_namespace_path
.I’m confused as to why a user should switch roles in the first place?