Identity proof and resource decisions
Evaluate who called separately from what that caller may do to a particular resource.
On this page
The question for today
What you’ll understand
- Distinguish authentication from an action-resource authorization decision.
- Preserve validated caller context through service boundaries.
- Test tenant and ownership checks after successful credential validation.
Mutual TLS or a validated token can establish an authenticated principal without granting it every operation on the server. Authorization evaluates a requested action, a resource, and relevant context against policy. Confusing the two creates APIs that are secure at the transport layer yet expose another tenant's data. Follow a request from identity validation to the exact object selected and the side effect performed.
Authentication produces context, not a universal allow
A successful credential check should produce a principal with validated authority and relevant claims, not merely a Boolean that any internal caller is trusted. The application still needs to decide whether that principal may read, update, delete, or delegate access to the requested resource. A network location or service certificate can be useful policy context, but neither automatically establishes ownership of every object identifier present in the request.
A user-supplied tenant or resource parameter must be checked against authoritative relationships rather than copied into the authorization context as truth. An authenticated user can change a URL identifier just as an anonymous one can. Evaluate the final resource actually accessed, including redirects, aliases, and backend lookups where they affect the decision. Authorization performed on one object while the operation mutates another is a correctness failure even when the initial identity was fully valid.
Context propagation has its own trust boundary
When a frontend calls a backend, distinguish an authenticated service assertion from arbitrary forwarded headers. A header naming a user is trustworthy only if the backend authenticates its source and the protocol prevents callers from forging that context. Delegation may preserve both actor and subject, or the backend may rely on a carefully defined service authorization. Document which model applies rather than accepting every internal header as proof of user authority.
Authorization decisions can become stale when membership, ownership, or policy changes. Cache them only with keys and lifetimes covering the principal, action, resource, relevant policy version, and required revocation behavior. Reusing a cached allow for a different tenant or action can bypass a correct policy engine. Likewise, checking permission and then acting after the resource changes can create a time-of-check/time-of-use race; strict invariants may need a transaction or version condition at the resource boundary.
Audit allowed and rejected actions separately
Test valid credentials with forbidden actions and resources, not just invalid credentials. Include same-identifier objects across tenants, recently removed group membership, and a resource whose ownership changes during a request. Audit both authentication failure and authorization denial with distinct reasons and safe identifiers. A spike in denials may reveal an overbroad client or a stale policy cache; a drop to zero denials can indicate a broken enforcement path rather than improved security.
The probability lab is a statistical contrast. Reset and set both p=0.5, n=10, predict five successes on average, then inspect. The trials are independent and interchangeable; real authentication and authorization outcomes need not be. The instrument does not validate identities, query ownership, or enforce policy. Use it to explain why multiplying two imagined success percentages is unjustified unless conditional relationships are known, then classify actual request outcomes by their distinct validation stages.
Work it through
One hundred protected requests
A trace contains 100 requests. Ninety authenticate successfully; among those ninety, seventy are authorized for the actual action and resource. Assume the other ten fail before a resource decision is made.
Authentication succeeds for 90% of the trace. That percentage does not mean ninety operations should run; the resource policy still applies to those requests.
Seventy requests execute under the stated conditions, twenty authenticated requests are denied, and ten fail authentication. Total rejected requests are thirty, with two different reasons.
Authorization success conditional on authentication is 70/90≈77.78%, while overall successful execution is 70%. Preserve that conditioning instead of treating authentication and authorization as independent random events.
Distinct stage outcomes explain both enforcement and user-visible completion without equating identity proof with permission.
The living notebook
Explore the model
Interactive lab · probability
Independent trials are not an access pipeline
Reset, set p=0.5, n=10, predict mean 5. These exact binomial trials have no identity, resources, policy, or conditional access stages and do not estimate production authorization success.
- Mean · np
- 5
- Variance · np(1−p)
- 2.5
- Total probability
- 1
These are exact binomial probabilities for independent trials with one fixed success probability. Playback tours the distribution; it does not resample outcomes. Parameter changes pause playback and recompute the model at the current elapsed time. Reset restores both parameters and returns time to zero. Playback starts paused. Adjust either parameter, then choose Play or Step.
Look forMeasure actual conditional outcomes instead of multiplying unrelated percentages.
Pause & reason
Check your understanding
Your turn
Try it yourself
A backend accepts a forwarded user header from any network peer and uses it for access decisions. Explain why encrypted transport alone does not make the user assertion trustworthy.
Take a moment to make a prediction or work it out on paper. Open a hint when you need one.
Give me a hint
Encryption protects a channel; it does not define who may assert another principal's identity.
Compare with the solution
An arbitrary peer can supply a chosen header unless the backend authenticates and authorizes the forwarding source and validates the assertion protocol. TLS encryption to the backend may protect that forged text in transit without making it true. Use a supported authenticated delegation/context mechanism, and still apply action-resource policy after resolving the target object.
Keep the idea
Take it with you
- Authentication supplies validated principal context.
- Authorization binds that principal to the actual action, resource, and trusted context.
- Forwarded context, cached allows, and concurrent resource changes need separate enforcement rules.
Read further
Original sources and deeper explanations to follow at your own pace.
Optional progress, saved in this browser when available. Revisit any lesson at any time.
Lesson not marked complete.