In this article
  1. Before you start
  2. Why interviewers ask this
  3. Identity and access management from first principles
  4. The Staff-level answer
  5. The rubric
  6. Three variants of this question
  7. Common mistakes
  8. Follow-up questions
  9. Sources

Before you start

This question sits in the distributed systems interview round, where you design a small service out loud.

Why interviewers ask this

The question is open on purpose, so the first thing a weak answer shows is a list of buzzwords: "OAuth, signed tokens, roles, multi-factor login." Interviewers use it to see whether a candidate can pick the smallest design that is still safe, and whether the candidate knows where security systems fail in practice: password storage, the default when no rule matches, and tokens that cannot be taken back.

A weak answer names tools without saying what each one protects. A strong answer separates proving who someone is from deciding what they may do, stores passwords in a form that survives a stolen database, and states the default decision. A Staff-level answer also says what the simple version leaves out and which gap hurts first. Candidates report this question in system design rounds; no company is named here because no public source ties it to one.

Identity and access management from first principles

Identity and Access Management
Identity and Access Management (IAM) is a service that records who users are, checks that a caller really is that user, and decides which actions that user may perform on which resources, so every other service can rely on one source of truth.
Authentication
Authentication is the step that proves who a caller is, for example by checking a password against a stored hash, and that ends with a verified identity such as a user id.
Authorization
Authorization is the step that decides whether a verified identity may perform one action on one resource, and that ends with allow or deny.
Policy
A policy is a rule that says a set of actions on a set of resources is allowed or denied, and it is attached to a user or to a role, which is a named bundle of permissions.

In plain words

Think of an office building. At the front desk a guard checks your badge photo against a register. That is authentication. Each door then has a list of who may enter. That is authorization. The analogy breaks in one place. An office door is usually open to staff by default. In a safe IAM design every door is locked until a rule opens it.

In one precise sentence, a simple IAM stores credentials, verifies them once to issue a signed token, and then checks policies on every request. It denies unless a policy allows and no policy forbids. Each of the four steps below adds one part of that sentence, so you can build the system in the order you would explain it out loud.

Step 1: Store users and verify passwords with a slow, salted hash

The user store is a table with a user id, a login name and a password hash. The server never stores the password. It stores the output of a password hashing function plus a random value called a salt, which is unique per user. The OWASP Application Security Verification Standard (ASVS) 4.0.3, requirement V2.4.1, says passwords are salted and hashed with an approved one-way function that takes a password, a salt and a cost factor.

The cost factor makes each guess slow. For the Password-Based Key Derivation Function 2 (PBKDF2), the same standard says the iteration count should be as large as the server allows, typically at least 100,000 (ASVS V2.4.3). Input: login name and password. Output: a verified user id, or a generic failure. At login the server hashes the typed password with the stored salt and compares. You now know how identity is proved; next comes what that identity may do.

Step 2: Policies decide, and an explicit deny beats any allow

The authorization check takes three inputs, the principal (who), the action and the resource, and returns allow or deny. Policies are statements of the form effect, actions, resources, attached to roles. The rule that matters is the default. In the Amazon Web Services (AWS) IAM User Guide, by default all requests are denied, and if a single policy contains a denied action, IAM denies the whole request and stops evaluating.

Copy that model. Collect the policies that apply, return deny if any deny statement matches, return allow if an allow statement matches, and otherwise return deny. In the worked policy, an editor has allow on doc:* for doc/* and a deny on doc:delete for doc/legal/*. Reading doc/plan is allowed, deleting doc/plan is allowed, deleting doc/legal/nda is an explicit deny, and reading billing:read on invoice/7 is a default deny because no policy mentions it.1

An explicit deny beats an allow and silence means denyFour requests against one editor policy: reading and deleting an ordinary document are allowed, deleting a legal document hits an explicit deny, and a billing request matches nothing and is denied by default.RequestMatching ruleDecisionread doc/planallow doc:*Allowdelete doc/planallow doc:*Allowdelete doc/legal/ndadeny doc:deleteon legalDeny (explicit)read invoice/7none matchesDeny (default)Diagram: Interview Clozo, CC BY 4.0 ·interview.clozo.ai/blog/how-would-you-build-a-simple-version-of-identity-access.html
An explicit deny beats a matching allow, and a request no policy mentions is denied.CC BY 4.0 — source: How would you build a simple version of Identity Access Management?
Text description of the diagram
  • Reading doc/plan is allowed by the allow on doc:*.
  • Deleting doc/legal/nda is an explicit deny.
  • A billing request that no policy mentions is a default deny.

Step 3: Carry the identity in a signed token

After a good login the server returns a token so the user does not send a password again. The token is called JavaScript Object Notation (JSON) Web Token (JWT). A JSON Web Token is a compact, URL-safe way of representing claims to be transferred between two parties (Request for Comments (RFC) 7519), such as the user id and roles. It can be verified because it is digitally signed, with a shared secret or with a public and private key pair (jwt.io).

Signing proves who issued the token and that it was not changed. It does not hide the contents, because only the separate encrypted form keeps claims secret (RFC 7519). So put no secrets in claims. With a key pair, any service holding the public key can verify a token without calling the user store. A sample token with a user id, one role and an expiry is 216 characters when signed with the Elliptic Curve Digital Signature Algorithm (ES256) and 173 characters when signed with a keyed hash (HS256) (illustrative claims).1 Give tokens a short expiry time.

Step 4: Write an audit log of every decision

An audit log is an append-only record of who tried which action on which resource and what the decision was. It is how you answer "who deleted this?" and how you notice a stolen account. Log the principal, action, resource, decision, the reason (explicit deny, allow, default deny) and a time. Never log passwords or full tokens.

The log is also the largest thing the simple design stores. At 1,000 requests a second and 200 bytes an entry (both illustrative), it grows by 17.28 GB a day, so decide early how long you keep it.1 You now have the whole system. Sizing it is the habit taught in back-of-the-envelope estimation.

Login proves identity once and every request is then checkedBoxes in four steps: a login service checks the user store, role policies feed an access check, a signed token carries identity to the check, and the check writes an audit log.Login serviceUser storepasswordhashesPolicy storeroles and rulesAccess checkallow or denySigned tokenAudit logDiagram: Interview Clozo, CC BY 4.0 ·interview.clozo.ai/blog/how-would-you-build-a-simple-version-of-identity-access.html

Identity is proved once at login, then every request is checked against policies and logged.CC BY 4.0 — source: How would you build a simple version of Identity Access Management?
Step-by-step description
  1. Login checks a salted, slow password hash.
  2. The access check denies by default.
  3. A signed token carries the identity.
  4. Every decision is written down.
  • Login checks the password hash in the user store.
  • The access check reads policies and denies by default.
  • A signed token carries the user identity to the check.
  • The check writes every decision to an audit log.

What the numbers say about capacity

Take 1,000,000 accounts (illustrative). A hash record of about 100 bytes each is 100 MB of user store, small enough for one ordinary database; see database interview questions. If 20% log in daily, that is 200,000 logins a day, about 2.31 a second on average and 23.1 at a peak ten times the average. A deliberately slow hash of 100 milliseconds (illustrative; measure your own) occupies one processor core per 10 logins a second, so peak login needs 3 cores.1 Per-request checks are cheap because they use the token and the in-memory policies, not the password hash. That is why login capacity and request capacity are sized separately.

Knowing it is half the job. Saying it is the other half.

Interview Clozo is an AI interview copilot for real interview rounds: it hears the question and puts a strong answer on your screen, and you say it in your own words. See the features or how it works.

Start Free Trial →

The Staff-level answer

Interviewer asks

How would you build a simple version of Identity Access Management?

A strong answer

I would build five parts. A user store with a salted, slow hash per password. A login endpoint that verifies the hash and returns a short-lived signed token. A store of roles and policies. An authorization check that takes who, action and resource, denies by default and lets any explicit deny win. And an audit log of every decision. What breaks first is revocation: a signed token stays valid until it expires, so I keep expiry short and add a deny list or refresh tokens later.

What makes it Staff-level: it states the default decision, names the one real weakness of the design (revocation) and says what comes next instead of listing every feature.

The rubric

Strong answers separate who from what, and Staff answers add the default decision, the revocation gap and a sizing check.
DimensionWeak answerStrong answerStaff answer
CorrectnessStores passwords encrypted or in plain textSalted, slow hash; separate login and checkAlso states default deny and explicit deny wins
DepthSays "use JWT" and stopsExplains signing and expiryNotes claims are readable, not secret
Trade-offsLists no limitsNames sessions versus tokensNames revocation and picks a mitigation
CommunicationJumps between topicsWalks one request end to endDraws five parts first, then goes deep
Follow-up readinessSurprised by "what if a token leaks"Has an answer for logoutHas capacity and audit numbers ready

Three variants of this question

What if you use role-based or attribute-based rules?

Role-based access control (RBAC) attaches permissions to roles and roles to users, which is the simple choice. Attribute-based access control (ABAC) decides from attributes such as department or resource owner, which is more flexible and harder to audit; start with roles and add attribute conditions to policies when roles multiply.

What if you must use sessions instead of tokens?

Store a random session id in a table and look it up on every request. Logout and revocation become one delete, at the price of a lookup per request; at 1,000 requests a second (illustrative) that is 1,000 lookups a second.1

What if many services must check access?

Put the check in a library or gateway that every service calls with the token, and distribute the public key so each can verify tokens locally. The same placement question appears in designing a distributed rate limiter for an API gateway.

Common mistakes

  • "I encrypt the passwords so I can recover them." (wrong) Encryption can be reversed by anyone with the key. (right) "I store a salted, slow hash, so nobody can read the password back, including us."
  • "A plain Secure Hash Algorithm (SHA) 256 hash with a salt is enough." (wrong) A fast hash lets an attacker guess quickly, and ASVS asks for a function with a cost factor. (right) "I use a password hashing function with a tunable cost."
  • "If no policy matches, allow." (wrong) Missing rules then grant access. (right) "Default deny; an explicit deny overrides any allow."
  • "The JWT is encrypted, so I can put the user's details in it." (wrong) A signed token is verifiable, not hidden. (right) "Claims are readable, so I keep them minimal."

Follow-up questions

Why not store passwords encrypted so you can recover them?

A system that can recover a password can leak every password if its key leaks. A hash is one-way, so a reset flow replaces the password instead of revealing it.

How do you log a user out if tokens are stateless?

A signed token stays valid until its expiry, so use short expiry times plus a refresh token that the server can delete, or keep a small deny list of token ids until they expire. Each choice adds some state back, which is the trade-off for stateless checks.

Where does the authorization check run?

Run it on the server that owns the resource, or in a gateway in front of it, never only in the client. The backend interview questions page covers where such checks sit in a request path.

What do you add first after the simple version?

Add multi-factor authentication (MFA) and login rate limiting first, because stolen and guessed passwords are the most common way in. Then add single sign-on (SSO) if other products must share logins. Reported practice differs on the exact order; the API design interview questions show how an authorization error should surface to callers.

Key takeaways
  • Split authentication (who) from authorization (what) and say so first.
  • Store a salted hash made by a function with a cost factor, never the password.
  • Default deny, and let any explicit deny beat an allow.
  • A signed token is verifiable but readable, so keep claims minimal and expiry short.
  • Name revocation as the weakness and say how you would close it.

Sources

  1. OWASP ASVS 4.0.3, V2.4 Credential Storage — OWASP (Application Security Verification Standard), 26 Oct 2026
  2. How IAM works: authorization and permission policy basics — Amazon Web Services (IAM User Guide), 26 Oct 2026
  3. RFC 7519: JSON Web Token (JWT) — IETF (RFC Editor), 1 May 2015
  4. Introduction to JSON Web Tokens — jwt.io (Auth0 by Okta), 26 Oct 2026