-
-
Notifications
You must be signed in to change notification settings - Fork 673
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
graphql-shield integration #448
Comments
Have you tried to use just |
Well, this is a good idea, and can be done by |
Could you elaborate on why you think it's not enough? |
Imaging that we have a resource that only available for users not only with role of And with graphql-shield, we can achieve it. |
But the bulti-in authorization module is not only about the string roles. It's basically storing the metadata you want by calling GraphQL shield API is strictly for applying the guard rules on apollo-like resolvers when we have typedefs defined as sdl string. So there's no need for making a wrapper on a wrapper for authorization. |
hmm...I finally realized...I just got caught into the naming of role and its default implementation of string...Maybe we should change the name of |
Just always read the docs first - TypeScript definitions are not enough to work with all te features of the new framework 😉
https://typegraphql.ml/docs/authorization.html#how-to-use In the future when #124 comes to live, I will refactor the authorization feature to use it and add an example/tutorial in docs how to create your own authorization layer with custom logic. So closing this issue for now 🔒 |
Does anyone have a working example of using graphql-shield rules in type-graphql, either using |
@MichalLytek Having an example would really help, one advantage of shield is the caching so you don't execute complex checks multiple times. |
|
This line I kept getting |
I had stumbled on this thread earlier so I decided I might be able to help. https://github.com/utkarsh867/typegraphql-authchecker And the package at: https://www.npmjs.com/package/typegraphql-authchecker Allows to define rules in the |
Is your feature request related to a problem? Please describe.
I'm frustrated when I need to defined a BIG AuthChecker and I need a graphql-shield-like approch to protect my resolvers.
Describe the solution you'd like
Make the Authorized decorator to accept graphql-shield rules and generate appropriate permission tree then apply it to the schema.
Just like this:
Describe alternatives you've considered
Here is my workaround approach, but I really hope that there would be a better official approach to model the authentication layer in type-graphql.
Additional context
No additional context so far.
The text was updated successfully, but these errors were encountered: