amplify-category-api icon indicating copy to clipboard operation
amplify-category-api copied to clipboard

Dynamic group authorization with prefix option for multi tenant support

Open biller-aivy opened this issue 1 year ago • 4 comments

Is this feature request related to a new or existing Amplify category?

api

Is this related to another service?

AppSync

Describe the feature you'd like to request

https://docs.amplify.aws/javascript/tools/cli-legacy/auth-directive/#dynamic-group-authorization

It would be nice if we could add a prefix per @auth rule.

type Post @model @auth(rules: [{ allow: groups, groupsField: "groups", prefixForGroupsFieldStrings: "reader__", operations: [...] }, { allow: groups, groupsField: "groups", prefixForGroupsFieldStrings: "updater__", operations: [...]}]) {
  id: ID!
  title: String
  groups: [String]
}

So at this point I could add the tenantID to groups and the reader__ und updater__ has different operations but with only one group array entry.

Describe the solution you'd like

add prefixForGroupsFieldStrings to @auth option.

Describe alternatives you've considered


Additional context

No response

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

  • [X] 👋 I may be able to implement this feature request

Would this feature include a breaking change?

  • [X] ⚠️ This feature might incur a breaking change

biller-aivy avatar Feb 29 '24 00:02 biller-aivy

Hey,👋 thanks for raising this! I'm going to transfer this over to our API repository for better assistance 🙂

ykethan avatar Feb 29 '24 14:02 ykethan

Hey @biller-aivy, Thank you for requesting this. We have marked it as a feature request for the team to evaluate further.

AnilMaktala avatar Feb 29 '24 19:02 AnilMaktala

Hi - we're working on a feature (it'll likely land closer to later this year), where we'll allow customers to add a tenantClaim to their authorization rules. This will be a logically "AND"ed rule that validates you only have access to a data record if both your other authz rules pass as well as tenantClaim matches the what's stored in the record's tenantField

renebrandel avatar Mar 01 '24 16:03 renebrandel

Any update on this @renebrandel? Would be great to have this feature!

jimjiminyjimjim avatar Feb 14 '25 01:02 jimjiminyjimjim