Design a Risk-Based Authentication Flow

Hard45 min
1 / 29
System design answer

Design a Risk-Based Authentication Flow

Hard45 min29 sections
understanding•11 min read

Problem Statement: Every Login Is an Adversarial Decision

Frames risk-based authentication as a continuous, context-aware decision engine, not a static login page with optional 2FA.

Problem statement

Design a risk-based authentication (RBA) platform that evaluates every authentication attempt — password login, SSO assertion, passwordless ceremony, token refresh, and sensitive-action step-up — against live signals from the network, the device, the account, and the user's behavior, then adjusts friction proportionally: low-risk attempts pass seamlessly, medium-risk attempts get a soft challenge, high-risk attempts get strong step-up or outright denial with recovery paths.

This is not "add 2FA to login". A static second factor taxes every user equally and still fails against adversaries who phish one-time codes. RBA treats authentication as an adversarial decision problem: the attacker adapts, so the system must score continuously, learn continuously, and degrade gracefully when any signal source fails. Microsoft's 2023 Digital Defense Report attributes roughly 30% of identity attacks to password spray and about 32% to phishing; Verizon's 2023 DBIR found the human element in 74% of breaches, and stolen credentials remained the most common initial access path. Okta reported in its 2023 "State of Phishing-Resistant Authentication" research that 97% of surveyed organizations experienced a phishing attack in the prior 12 months. These are public, cited figures; every other number in this answer is an explicit design assumption.

Why this problem is distinctive

A payment gateway can retry a declined transaction. An authentication decision cannot retry trust: a false negative lets an attacker into a live session; a false positive locks a legitimate user out at the worst moment and trains them to bypass security prompts. The design therefore separates decision correctness (did we block the right attempts) from decision availability (can we still authenticate anyone when the intelligence plane is down). The risk engine must fail toward a defined degraded policy, never toward a hanging login spinner.

The problem requires four capabilities: a risk scoring aggregator (FR1), step-up when risk crosses thresholds (FR2), device recognition and geolocation (FR3), and clean integration with normal login/SSO (FR4), under latency, scale, false-positive, and ML-refresh constraints (NFR1-NFR4).

The five architectural planes

  1. Signal plane: collection and normalization of raw evidence — IP reputation, TLS fingerprints, device attestation, event streams, third-party intelligence.
  2. Decision plane: feature assembly, rules, ML scoring, policy evaluation. Synchronous, latency-critical, and independent of intelligence plane health.
  3. Challenge plane: step-up orchestration across factors (WebAuthn, push, TOTP, OTP), with attempt limits, expiry, and lockouts.
  4. Identity plane: SSO integration (OIDC/SAML), session issuance, ACR/AMR claim propagation.
  5. Feedback plane: outcomes, analyst labels, drift monitoring, model retraining, policy tuning.

A strong answer keeps these planes separate. The feedback plane may be hours late without hurting a single login; the decision plane must answer in under 150 ms even when every downstream intelligence service is unreachable.

Key Highlights

  • •RBA scores every attempt continuously; static 2FA applies the same tax to every user regardless of context.
  • •Public figures: Microsoft 2023 DDR puts password spray at ~30% and phishing at ~32% of identity attacks; Verizon 2023 DBIR finds a human element in 74% of breaches.
  • •Decision-plane availability is separate from intelligence-plane freshness: a login must complete even when the feature store is down.
  • •Five planes: signals, decision, challenge, identity, feedback — each with different latency and consistency needs.
  • •A false positive at the wrong moment is a security incident too: it trains users to ignore prompts and floods support.
Lead With the Decision Boundary
State in the first two minutes that the decision plane must answer in under 150 ms even when every intelligence source is unreachable. That instantly separates a risk engine from a dashboard.
Do Not Draw a Login Form With an If-Statement
A design where 'if score > 70 then ask for OTP' is the entire architecture misses the signal pipeline, the policy engine, the challenge orchestration, and the feedback loop. An interviewer will probe all four.

Section Rescue Kit

Buzzwords to use:

Adaptive AuthenticationDegraded Decision Policy

Safe statements:

  • "I will separate decision-plane availability from intelligence-plane freshness before choosing any technology."
  • "The goal is proportional friction: zero added steps for the 90%+ of attempts that are clearly benign."
Design a Risk-Based Authentication Flow - System Design | WinJob | WinJob