Skip to content
engineering workbench.by StudyPort Academy
Learning path
Intermediate18 min

Authorization models

Understand the idea

RBAC asks for the role. ABAC asks about this user and this resource. Scopes ask what the token was issued to do.

The idea

is the job title. The matrix says editors may write notes and readers may only read them. It is easy to audit and clumsy when the rule is really this department and this clearance. ABAC looks at attributes on both sides: the user's department equals the document's department, and the clearance is high enough. Scope-based checks look at the token, not the person's whole job. A token issued with notes:read must not write, even if that person is an editor in the role matrix. The three prints are the same action asked three ways. The reader fails RBAC. The matching department passes ABAC. The read scope fails the write.

What changes

Three decisions, three inputs
ModelThe yes looks atWhere it gets awkward
RBACThe caller's role and the actionRules like same department need a new role for every combination
ABACAttributes of the user and of this resourceThe rule is harder to read and easier to get half-wrong
ScopesThe list on this tokenA wide role and a narrow token disagree unless you check the token

The command

Reader, department, and scope

3s timeout · one stateless run. Node and Express use Piston when that instance accepts the job (public EMKC execute is whitelist-only; set PISTON_URL or PISTON_TOKEN). Otherwise a local Node process. MongoDB uses a fresh in-memory server per run, then it is stopped.

The mistake

Check the result

rbac is false for a reader writing. abac is true when department and clearance match. scope is false when the token only has notes:read.

Guided challenge

Use the role matrix

rbac currently returns true for every known role, so a reader can write. Check the action against that role's list.

Use the role matrix

3s timeout · one stateless run. Node and Express use Piston when that instance accepts the job (public EMKC execute is whitelist-only; set PISTON_URL or PISTON_TOKEN). Otherwise a local Node process. MongoDB uses a fresh in-memory server per run, then it is stopped.

EXPECTED RESULT

rbac false
abac true
scope false

Hints 0/2

    Use all hints or make 3 failed checks (0/3).

    Free exploration

    Change this example and run it again. Each run is a new process. Nothing is saved.

    Your variation

    3s timeout · one stateless run. Node and Express use Piston when that instance accepts the job (public EMKC execute is whitelist-only; set PISTON_URL or PISTON_TOKEN). Otherwise a local Node process. MongoDB uses a fresh in-memory server per run, then it is stopped.

    Quiz

    A quick check for understanding. Retry as often as you like; your learning path stays open.

    01What does RBAC look at?
    02What is a scope?

    Ready to call this one understood?

    Mark this lesson complete to earn 150 XP. You can always revisit it.

    Sign in to save progress
    Next lesson