SecLab
The risk map and an AppSec mindsetconceptDifficulty 2/518 min

Authentication and authorisation: two different questions

Objective: After this lesson you can point at any endpoint and say which line answers "who are you" and which answers "what may you do".

V8API1:2023A01:2025access-control
Step 1 of 4 · read5 min

Two questions, answered in two places

Authentication answers who are you. The input is a proof — a password, a passkey, a token — and the output is an identity. It happens once per request, in middleware, and it knows nothing about the data the request is reaching for.

Authorisation answers what may you do. The input is an identity plus a specific object, and the output is allow or deny. It happens every time an object is touched, in the business layer or the query layer.

The most important point, and the one most often missed: middleware cannot answer the second question. [Authorize] knows Bob is Bob. It does not know what 1042 is, does not know whether 1042 is Bob's, and has nowhere to find out — that information lives in the database. This is why an endpoint can carry a perfectly good [Authorize] and still hand over someone else's data.

There is a third question sometimes conflated with authorisation: what role do you have. [Authorize(Roles = "Admin")] answers that, and it is authorisation — but only at the function level (API5, "may you call this endpoint"), not the object level (API1, "may you read this record"). Two levels, two different fixes, and a real system needs both.

QuestionNameWhere it livesCalled this when broken
Who are you?AuthenticationMiddleware, once per requestA07 Authentication Failures
May you call this function?Function-level authzAttribute or policy on the actionAPI5 / BFLA
May you touch this object?Object-level authzInside the query, every accessAPI1 / BOLA / IDOR
View path

Comments

Join the discussion
Sign up to comment

Commenting needs an account with at least one completed lesson. That condition is what keeps this thread worth reading: every point belongs to someone who can be asked back, and reputation accrues over time.

Sign upSign in

You can still read every comment below without an account. Signing in brings you back to this exact spot, not to the top of the page.

Loading comments…