Preparing your design workspace

Loading the problem and your saved attempt…

Design an Authentication Session Lifecycle

Design the objects and contracts for sign-in, authenticated requests, credential refresh, and logout.

Design the low-level object model and interfaces for an authentication session lifecycle.

For this exercise, assume an existing registered user signs in with an email address and password. A successful sign-in returns a short-lived access credential and a longer-lived refresh credential. A protected request validates the access credential.

Refreshing rotates the refresh credential, exactly one successor may be authorized, and replaying a consumed refresh credential revokes its refresh family. Logout immediately prevents that refresh family from being used again.

Each device owns a separate session, so logging out one device does not end the user's other sessions.

Passwords must be stored only as secure hashes and must never be logged or returned. If logout occurs while an access credential is still valid, that access credential may remain usable only until its short expiry; refresh is revoked immediately.

Your design should give deterministic outcomes for invalid credentials, expired access, refresh replay, and concurrent refresh or logout operations.

Keep registration, password reset, multi-factor authentication, social login, and cross-service signing-key distribution out of scope. Focus on cohesive responsibilities, explicit state transitions, secure boundaries, and testable behavior rather than framework-specific code.