Authentication & Authorization
Proving who a caller is — by session cookie, bearer token or second factor — then deciding what they may do. Interviewers separate the two because conflating them starts most access-control bugs.
on this pageshowhide
explore
- Server-Side Sessions22 questions
- Identifier Issuance & Signing4 questions
- State Stores & Distribution2 questions
- Rotation, Expiry & Logout3 questions
- Placing CSRF Defence2 questions
- Anonymous & Pre-Login State4 questions
- Binding & Hijack Detection4 questions
- Inventory & Global Revocation3 questions
- Token Handling25 questions
- Signing Keys & Issuance3 questions
- Resource-Server Verification4 questions
- Refresh, Rotation & Revocation4 questions
- Client Storage & Transport Trade-offs5 questions
- Machine Keys4 questions
- Signed Requests3 questions
- Credentials for Queued Work2 questions
- OAuth2 & OIDC Integration18 questions
- Implementing the Relying Party3 questions
- Service-to-Service Tokens4 questions
- Identity Propagation & Token Exchange3 questions
- Running Your Own Issuer3 questions
- Third-Party API Grants3 questions
- Federated Logout Propagation2 questions
- Access Control Models & Enforcement34 questions
- RBAC Modeling4 questions
- ABAC & Policy Engines4 questions
- ReBAC Relation Tuples6 questions
- Choke Points4 questions
- Tenant Isolation3 questions
- Testing & Auditing4 questions
- Delegation & Acting As3 questions
- Field-Level Rules3 questions
- Filtered Listings3 questions
- Credentials & Multi-Factor24 questions
- Password Policy & Changes2 questions
- TOTP Codes & Secrets5 questions
- WebAuthn & Passkeys6 questions
- Step-Up Elevation2 questions
- Recovery, Lockout & Enumeration3 questions
- Out-of-Band Codes3 questions
- Remembered Devices3 questions
- Workforce Identity29 questions
- SAML Service-Provider Integration6 questions
- Multi-Tenant IdP Patterns6 questions
- SCIM Endpoint Contract6 questions
- Account Linking & Merging4 questions
- Account Lifecycle & Drift3 questions
- Testing Federated Integrations4 questions
questions
152 · 6 sectionsWhy does a guest's held campsite selection vanish at sign-in unless the server copies it into the new server-side session record?
basics
~20 sBecause the selection is filed server-side under the identifier the visitor had before signing in, and sign-in issues a new one. Carrying it over is an explicit step in the login handler, and not every item should be carried.
A playout scheduler's session cookie carries `presenter=dmorgan; role=engineer` in plain text — what stops a presenter becoming the engineer?
basics
~20 sNothing stops them. A cookie value is input the caller can retype, so a plain-text role claim is simply edited. The value must be an unguessable reference to a record the scheduler holds, or state the server can prove it wrote.
A server-side session runs on an idle clock and an absolute clock — what does each one defend against?
basics
~20 sThe idle clock restarts on every request and ends a session left unattended. The absolute clock counts from the sign-in that created the record, never restarts, and caps how long one authentication may keep counting.
What handle should a server issue between a successful password step and a verified second factor, and how must it differ from a signed-in session?
basics
~20 sA short-lived, single-purpose pre-authentication handle bound to one login attempt and to the factor still pending, carrying no authority to reach application endpoints. It must be its own credential, not a signed-in session record wearing a pending flag.
Your server pins each stored session record to the client address seen at login — what does that buy, and what breaks?
basics
~20 sPinning raises the cost of using a stolen session reference — the thief must also call from that network — but never prevents it. The price is paid by legitimate callers whose address moves: roaming clients, carrier re-addressing and shared egress pools.
A partner station posts telemetry with a long-lived API key that never expires — what does your ingest service store for it?
basics
~20 sStore a one-way digest of the key, never the key itself, alongside a non-secret prefix and last characters for display, the owning station, the key's permissions, and timestamps. The plaintext is shown once at creation and is not recoverable afterwards.
Your server stores each sensor's long-lived refresh credential in a table — why store a hash of it, and one row per device?
basics
~20 sStoring only a digest keeps the table from being a pile of live bearer credentials: a leaked read yields nothing a sensor could present. One row per device keeps revocation targeted, so killing one sensor does not strand the whole fleet.
Where a browser client keeps an access token between requests decides which attack wins — which attack goes with which resting place?
basics
~20 sA token in script-readable storage loses to script injection; a token in a cookie the browser attaches automatically loses to cross-site forged requests. Neither is safer until you name the threat you are buying down.
A verified access token's `scope` claim names three permissions — may the caller now perform all three on your service?
basics
~20 sNo. A scope records the ceiling the issuer put on what the caller may ask for; it grants nothing on your service. Your own authorization rules still decide, and both the scope check and your rule must pass.
You are minting long-lived ingest keys for four hundred partner stations — how many random bits, what leading segment, and which one-way function at rest?
basics
~20 sAt least 128 bits from a cryptographically secure generator; a fixed, recognisable leading segment plus a non-secret key identifier; and a fast cryptographic digest such as SHA-256 as the verifier. A deliberately slow password-hashing function is the wrong tool for a high-entropy machine key.
A server-side relying party redirects a depot supervisor to the fleet operator's identity provider — what must it keep until the callback arrives?
basics
~20 sA relying party parks one short-lived record per sign-in attempt, holding the value it sent as state, the nonce, the code_verifier, which provider was used, and the page the user was heading to. The callback request itself brings back almost none of that.
A scheduled meter-polling service holds its own machine token — why cache it instead of acquiring one per outbound call?
basics
~20 sA machine token stays valid for the whole expires_in window the authorization server granted, so one acquisition serves thousands of polls. Acquiring per call adds a round trip to every request and hammers a shared, rate-limited endpoint for nothing.
A user disconnects your meal planner at their grocery-list provider — how does your server find out?
basics
~20 sNo notification arrives. The next refresh of that user's stored grant is refused with invalid_grant, or an API call answers 401, and that refusal is terminal: mark the row dead and stop the work rather than retrying.
At federated login, what must your server record so that a later logout notice naming a provider session identifier maps onto local sessions?
basics
~20 sRecord the issuer, the subject and, when the provider issues one, the provider session identifier on every local session row you create at login. Without that index an arriving logout notice names nothing you hold, and your endpoint can only discard it.
Your service can run its own OAuth 2.0 authorization server or rent a managed one — what does each choice leave your team to operate?
basics
~20 sRenting moves the login path's uptime, its abuse handling and most of its key custody onto someone else; running your own leaves you all three plus the on-call rotation behind them. Neither choice moves your obligation to show who consented to what.
On a claims desk, why must an acting-as session carry both the supervisor acting and the adjuster acted for?
basics
~20 sAn acting-as session has two principals: the actor doing the work and the subject whose authority is being used. Carry only the subject and every record reads as the adjuster's own work, so nothing shows who really acted.
Why does an authorization check placed only in the HTTP handler miss the nightly job and e-mail intake that also close tickets?
basics
~20 sA check in the HTTP handler only runs when a request reaches that handler. A scheduled job, a message consumer or an import script call the ticket-closing code directly, so the guarded path is simply not on their route.
A booking service serves many charterers — where does the server get the charterer identifier for a request, and why never from the request body?
basics
~20 sThe charterer identifier must come from something the caller cannot rewrite: a claim in the verified credential, the hostname the request arrived on, or a header the edge sets and strips. A body field is caller-controlled input.
Why does an application store permissions as resource-action strings like establishment:inspect rather than one boolean column per feature?
basics
~20 sA permission string names one resource and one action together: establishment:inspect is the inspect action on establishment records. Keeping permissions as rows makes capability data rather than schema, so adding one is an insert instead of a new column and a deployment.
In relationship-based access control, what does one relation tuple `object#relation@subject` record, and what replaces a role column?
basics
~20 sA relation tuple records one fact — this subject holds this relation on this object, written object#relation@subject. Permission becomes the set of stored tuples plus the schema's rules about which relations imply which, instead of a role value stored on the user row.
A donor portal emails a one-time sign-in code. What does the server write down so it can verify it later?
basics
~20 sA pending-attempt record on the server: a digest of the delivered code, the sign-in attempt it belongs to, an expiry a few minutes out, a consumed marker, and the count of failed guesses against it.
Why is an authenticator app's shared secret stored in recoverable encrypted form rather than hashed like a password?
basics
~20 sA time-derived code is recomputed by the server from the shared secret and the clock, so it must hold that secret itself, not a digest. Encrypting it at rest protects it from a database read, and nothing more.
Why must your server generate a passkey ceremony's challenge itself and accept each one only once?
basics
~20 sA passkey challenge is what makes each ceremony unrepeatable. The server generates it randomly, holds it against one pending ceremony and spends it on use, so a captured response cannot be replayed. The specification requires unguessable entropy and recommends at least 16 bytes.
On a remembered device a sign-in skips the second factor — what does the server store per device, and what is that token bound to?
basics
~20 sA remembered device is its own server-side record — account, a hash of the issued value, issue time, absolute expiry — and the value it hands the browser is bound to one account and one browser profile, never to a person.
A donor portal leaves every sign-in code it has sent valid until expiry. What does that cost the attempt cap?
basics
~20 sEvery simultaneously valid code multiplies an attacker's odds per guess. A cap of five guesses against one live six-digit code is about five chances in a million; twelve live codes make the same cap worth sixty in a million.
A booking tool's account row carries one identity-provider column. What does replacing it with a separate identity table buy, and what does it cost?
basics
~20 sA child identity table of (issuer, subject) rows, uniquely constrained on both columns together, lets one account be reached by several sign-in routes. It costs a lookup on every federated sign-in and a last-route rule the schema cannot enforce.
With only an email address typed at sign-in, how do you route the person to the right brand's identity provider?
basics
~20 sTake the domain from the typed address, look it up in a table of domains a tenant has verified, then follow that tenant to its identity-provider connection record and redirect. An unmatched domain falls back to local sign-in.
Your federated sign-in tests install an already-authenticated principal in the harness — which part of the integration stays unexercised?
basics
~20 sA helper-installed principal leaves the whole validation path unexercised. The test starts after the assertion would have been parsed, its signature checked, its audience and validity window enforced and its identifier recorded — so every rejection rule the service provider owns is untested.
When you stand in for a venue operator's identity provider in tests, why must the stand-in really sign its assertions?
basics
~20 sBecause the checks worth testing are rejections, and a stand-in that does not sign cannot produce a message that is signed by the wrong key. Holding a test keypair lets the suite mint both the accepted message and every rejected variant of it.
In a shared driver-hours system whose records are a legal archive, what does deleting a departed driver's account cost that deactivating it does not?
basics
~20 sDeleting destroys attribution: the hours entries, corrections and approvals the driver authored can no longer be resolved to a person, and the identifier could later be handed to someone else. Deactivation keeps the identity resolvable while ending sign-in.