Skip to content
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

Global Auth (inheritance) for @sql data #2774

Open
2 tasks
toddaa opened this issue Aug 14, 2024 · 0 comments
Open
2 tasks

Global Auth (inheritance) for @sql data #2774

toddaa opened this issue Aug 14, 2024 · 0 comments
Labels
feature-request New feature or request RDS

Comments

@toddaa
Copy link

toddaa commented Aug 14, 2024

Describe the feature you'd like to request

I do not see a solution to configure global auth rules for an SQL-backed data type. Please correct me if I'm missing something, but this makes it a bit tedious and repetitive to assign an auth rule to the query and then to each field the type can return. I'd love to see my query auth rules inherited by the fields until an override is in place.

Describe the solution you'd like

Example schema is below:

type Contact {
  id: Int
  first_name: String
  last_name: String
}

type Query {
  listContacts(companyId: Int): [Contact]
  @sql(reference: "getContacts")
  @auth(rules: [
    { allow: private, provider: userPools },
    { allow: public, provider: apiKey }
  ])
}

I'd like to see a valid response when authenticated to my userpool. Currently, it's only working if I add field-level auth to each field in the Contact type which seems needless. If all the fields could inherit the auth rule above until then your field level can be treated like overrides which is more similar to a DynamoDB backed data source.

Describe alternatives you've considered

The @function directive has been my alternative, but it's far easier to let this construct generate the lambdas to run the query.

Additional context

No response

Is this something that you'd be interested in working on?

  • 👋 I may be able to implement this feature request

Would this feature include a breaking change?

  • ⚠️ This feature might incur a breaking change
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature-request New feature or request RDS
Projects
None yet
Development

No branches or pull requests

3 participants