Skip to content

Instantly share code, notes, and snippets.

@james2doyle
Created July 13, 2021 23:46
Show Gist options
  • Save james2doyle/1595695539194212b7bfbf35a7059695 to your computer and use it in GitHub Desktop.
Save james2doyle/1595695539194212b7bfbf35a7059695 to your computer and use it in GitHub Desktop.
Authentication is the act of validating that users are who they claim to be. Authorization is the process of giving the user permission to access a specific resource or function. Taken from Redwoodjs Role Based Access Control

Authentication vs Authorization

Taken from Redwoodjs Role Based Access Control

How is Authorization different from Authentication?

Authentication is the act of validating that users are who they claim to be. Authorization is the process of giving the user permission to access a specific resource or function.

In even more simpler terms authentication is the process of verifying oneself, while authorization is the process of verifying what you have access to.

House and Blog Role-access Examples

When thinking about security, it helps to think in terms of familiar examples.

Let's consider one from the physical world -- access to the various rooms of a 🏠 house -- and compare it to a digital example of a Blog.

RBAC Example: House

Consider a 🏠 while you are away on vacation.

You are the owner and have given out πŸ”‘ keys to your neighbor and a plumber that unlock the 🏠 πŸšͺ door.

You've assigned them passcodes to turn off the 🚨 alarm that identifies them as either a neighbor or plumber.

Your neighbor can enter the kitchen to get food to feed your 😸 and the your office to water your 🌡 and also use the 🚽.

The plumber can access the basement to get at the pipes, use the 🚽, access the laundry or 🍴 kitchen to fix the sink, but not your office.

Neither of them should be allowed into your πŸ› bedroom.

The owner knows who they claim to be and has given them keys.

The passcodes inform what access they have because it says if they are a neighbor or plumber.

If your 🏠 could enforce RBAC, it needs to know the rules.

Role Matrix for House RBAC

Role Kitchen Basement Office Bathroom Laundry Bedroom
Neighbor βœ… βœ… βœ…
Plumber βœ… βœ… βœ… βœ…
Owner βœ… βœ… βœ… βœ… βœ…

RBAC Example: Blog

In our Blog example anyone can view Posts (authenticated or not). They are public.

  • Authors can write new Posts.
  • Editors can update them.
  • Publishers can write, review, edit and delete Posts.
  • And admins can do it all (and more).

Role Matrix for Blog RBAC

Role View New Edit Delete Manage Users
Author βœ… βœ…
Editor βœ… βœ…
Publisher βœ… βœ… βœ… βœ…
Admin βœ… βœ… βœ… βœ… βœ…
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment