-
Notifications
You must be signed in to change notification settings - Fork 348
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
feat(options) postgraphile: add contextOptions to allow custom jwt claims #3915
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
🦋 Changeset detectedLatest commit: e2ff960 The changes in this PR will be included in the next version bump. This PR includes changesets to release 47 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
@MarkLyck is attempting to deploy a commit to the The Guild Team on Vercel. A member of the Team first needs to authorize it. |
MarkLyck
changed the title
add contextOptions
postgraphile handler: add May 7, 2022
contextOptions
to allow custom jwt claims
MarkLyck
changed the title
postgraphile handler: add
postgraphile handler: add contextOptions to allow custom jwt claims
May 7, 2022
contextOptions
to allow custom jwt claims
MarkLyck
changed the title
postgraphile handler: add contextOptions to allow custom jwt claims
feat(handler-options) postgraphile: add contextOptions to allow custom jwt claims
May 9, 2022
MarkLyck
changed the title
feat(handler-options) postgraphile: add contextOptions to allow custom jwt claims
feat(options) postgraphile: add contextOptions to allow custom jwt claims
May 9, 2022
Closed
ardatan
force-pushed
the
master
branch
2 times, most recently
from
February 14, 2023 05:53
c3c0b9e
to
696f9c7
Compare
ardatan
approved these changes
Apr 3, 2023
Closed
This was referenced Apr 30, 2024
Closed
Closed
Closed
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Please include a summary of the change and which issue is fixed. Please also include relevant motivation and context. List any dependencies that are required for this change.
This adds
contextOptions
to list of possible options for thepostgraphile
handler.Currently the postgraphile handler only exposes
buildOptions
(called justoptions
in the docs) which per the postgraphile docs cannot be used to specifypgSettings
Our production postgres deployment makes use of row level security rules that require custom jwt claims, which is fully supported in postgraphile via the
pgSettings
object.However graphql-mesh doen't provide any way to define
pgSettings
. This PR allows the user to change postgraphile's context settings (which is where pgSettings needs to be defined).Just like the regular postgraphile build options, it is optional whether or not to specify this.
Fixes #3913
Type of change
Please delete options that are not relevant.
How Has This Been Tested?
Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration
it('dummy', async () => {});
I'm not familiar enough with the test methods for the graphql-mesh server, to set up a full test method and suit for adding this extra option.Test Environment: Real project using graphql-mesh with postgraphile.
Checklist:
Further comments
If this is a relatively large or complex change, kick off the discussion by explaining why you chose the solution you did and what alternatives you considered, etc...
For my use-case I only need the pgSettings to be exposed in a function with access to the
request
orcontext
so I can add the necessary jwt claim tokens to get postgraphile to respect our postgres Row Level Security rules.My first thought was to only expose
pgSettings
, but in case anyone needs to overwrite some of the other context options in the future, I opted to expose acontextOptions
function, that just like the regular options spreads and overwrites and default settings if the user chooses to do so.I would be happy to have a discussion if there's any other way to implement this, but it seems like a pretty straight forward option.