hasura / hasura/graphql-engine

Provide same functionality as JWT in Webhook based authentication

Open
#9,524 1 comment 0 reactions 0 assignees View on GitHub
k/enhancement t/gql-services
Dominant language
TypeScript
Stars
32.1k
Forks
3k
PR merge metrics
PR metrics pending

Description

The current JWT based authentication system allows users to choose a role by using the x-hasura-role header. This involves specifying the possible roles through x-hasura-allowed-roles, and a default role through x-hasura-default-role, after which the consumer can select a role via the x-hasura-role header. It would be great to extend this functionality to webhooks as well.

Currently, our auth webhook employs a complicated graphql query/mutation parsing logic to provide dynamic roles to a user by analyzing the query. However, it would be more convenient if we could avoid query analysis and instead have the same role selection options as provided by JWT. The webhook would return the same data as JWT, i.e., x-hasura-allowed-roles and x-hasura-default-role, and the user would be able to either use the default role or choose a role through the x-hasura-role header.

If this is acceptable I'd be more than happy to create a PR for this

Contributor guide

Open the contributing guide

Research direction

Start by comparing the existing JWT role-selection behavior with the webhook authentication flow described in the issue. No files or tests are named; done means webhook authentication supports allowed and default roles and lets consumers select a role through x-hasura-role without query parsing.

Written by the indexing model from the issue text.

Assessment

Tech stack
graphql
Domain
api, authentication, authorization
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.