-
Notifications
You must be signed in to change notification settings - Fork 142
chore(RFC): open core module system v1 #1063
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
A few goals I'd like to see covered:
Additional comments: I'll look more into the RFC and give more specific feedback later/tomorrow. |
|
||
## Custom Authentication and Authorization | ||
|
||
Custom modules can be used to implement custom authentication and authorization logic in the router. The module can intercept incoming requests and validate the user's credentials, scopes, and permissions before forwarding the request to the subgraph. The router has built-in support for JWK. The parsed token information is available in the request `req.Request.Auth` field. |
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 would suggest supporting the scenario where you only want to customize authentication but still use the built in authorization via directives (such as requiresScopes). For example, if I sign my JWT using an algorithm that Cosmo doesn't support, I would like to build a custom auth plugin that validates the JWT and injects the claims/scopes into the context, so that Cosmo can authorize access using the directives in the schema.
|
||
// OperationHooks are called when an operation is parsed, normalized, or planned | ||
|
||
type GraphQLOperationParseHook interface { |
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.
Can we have add a GraphQLOperationPreParseHook? I am asking because I think we can use this new module system to implement Persisted Operations feature and PO fetching is done before parsing the operation.
Motivation and Context
Related work:
TODO