-
Notifications
You must be signed in to change notification settings - Fork 2
feat(router): jwt auth #455
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
base: main
Are you sure you want to change the base?
Conversation
✅
|
🐋 This PR was built and pushed to the following Docker images: Image Names: Platforms: Image Tags: Docker metadata{
"buildx.build.ref": "builder-e23c6151-fc29-44af-9aa4-20c7804c7e0b/builder-e23c6151-fc29-44af-9aa4-20c7804c7e0b0/wrvopepresvmohpp4wng0vsef",
"containerimage.descriptor": {
"mediaType": "application/vnd.oci.image.index.v1+json",
"digest": "sha256:1bb42e81947f2f4a1aec0f8ecaf64ad7e865605710bcc0611f879060a77491d5",
"size": 1609
},
"containerimage.digest": "sha256:1bb42e81947f2f4a1aec0f8ecaf64ad7e865605710bcc0611f879060a77491d5",
"image.name": "ghcr.io/graphql-hive/router:pr-455,ghcr.io/graphql-hive/router:sha-86e34fd"
} |
feat(router): added a mechanism to store per-request context using req.extensions feat(router): jwt authentication config feat(config): added jwt config fix(config): load references files relative to the config directory, or current if not specified chore: added e2e test setup and testkit
} | ||
|
||
if self.config.forward_claims_to_upstream_header.enabled { | ||
jwt_ctx.payload = Some(( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does it really make sense to forward the payload with headers? Couldn't it be better to forward it through extensions as in Hive Gateway?
https://the-guild.dev/graphql/hive/docs/gateway/authorization-authentication#in-upstream-graphql-subgraphs
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wasn't sure what would be the best here. Other HTTP servers like Envoy pass it as headers (forward_payload_header
). But there it's also base64. https://www.envoyproxy.io/docs/envoy/latest/api-v3/extensions/filters/http/jwt_authn/v3/config.proto
I'm not sure if it should be in extensions
as JSON object, or as headers (raw? base64?)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
extensions
is GraphQL-native way to do this independent from the transport and payload format. Headers can be bloated with the payload if it is big.
Closes #314
Closes #457
Fixes #458
Closes #452 (because it's using it)
Overview
This PR introduces a JWT authentication flow. The following are supported:
Authorization: Bearer XYZ
)false
)In addition, this PR have some required changes and bug fixes:
req.extensions
)TODO