Skip to content

Instantly share code, notes, and snippets.

@StevenACoffman
Last active November 25, 2024 17:54
Show Gist options
  • Save StevenACoffman/baa6b7bd8c172ae43433e5213d8c88d2 to your computer and use it in GitHub Desktop.
Save StevenACoffman/baa6b7bd8c172ae43433e5213d8c88d2 to your computer and use it in GitHub Desktop.
GraphQL Authorization

Not related, but cool: https://wundergraph.com/blog/graphql_query_ast_minification

With Role-Based Access Control, we grant permissions based on roles, and then assign the roles to the users. For instance, WordPress has an administrator role with access to all resources, and the editor, author, contributor, and subscriber roles, which each restrict permissions in varying degrees, such as being able to create and publish a blog post, just create it, or just read it.

With Attribute-Based Access Control permissions are granted based on metadata that can be assigned to different entities, including users, assets, and environment conditions (such as the time of the day or the visitor’s IP address). For instance, in WordPress, the capability edit_others_posts is used to validate whether the user can edit other users’ posts.

In general terms, ABAC is preferable over RBAC because it allows us to configure permissions with fine-grained control, and the permission is unequivocal in its objective.

https://blog.logrocket.com/authorization-access-control-graphql/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment