-
Notifications
You must be signed in to change notification settings - Fork 821
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
@auth Per Field #111
Comments
I think this is a good idea. Have you thought more about how you would like to see it implemented? I see two main options:
type Post @model @auth(allow: owner, fields: ["a", "b", "c"]) { ... } Pros: Simple. Allows grouping fields. Cons: Does not leverage the type system.
type User @model {
ssn: String @auth(allow: owner)
} Downsides of this approach are that you would have to define @auth per field that you want to protect. That being said you could always put @auth on the type with the most basic auth for all fields then fine tune using @auth on the field level. Let me know what you think. |
Hi @mikeparisstuff, thanks for your reply. I think I like the 2nd one better. It is more declarative and explicit when looking at the schema from a top level. Agreed, you'd generally want the most basic auth at top level for the model and then fine-grained definitions on a per-field basis. |
This would be absolutely amazing to have. |
We (the AWS AppSync team) are currently looking for feedback on a server side solution for supporting field level auth and would love community feedback on the following RFC: |
For anyone looking (On Google, I found this first instead of the actual docs and only found them two days later): This is supported now: https://docs.amplify.aws/cli/graphql-transformer/directives#field-level-authorization |
This issue has been automatically locked since there hasn't been any recent activity after it was closed. Please open a new issue for related bugs. Looking for a help forum? We recommend joining the Amplify Community Discord server |
Is your feature request related to a problem? Please describe.
Right now the
@auth
transformer can be applied to the model, but some use cases come up where you want only certain users to be able to access specific fields on a Type.Describe the solution you'd like
Would like to be able to use the
@auth
transform on a per field basisDescribe alternatives you've considered
None, other than be implementing custom resolvers.
Additional context
None.
The text was updated successfully, but these errors were encountered: