Security and Authentication in System Design

A known user is not automatically allowed to do everything

Identity and permission checks belong in the flow

Request and identityUse a reviewed trust mechanism
Action and object permissionEvaluate policy on the server
Allowed data operationLeast privilege and safe interfaces
An identity mechanism establishes a principal. Server-side rules check the requested action and object. Data access follows only the permitted operation.

A customer signs in and requests an order. The service needs to establish who the customer is and whether that customer may access this particular order. Those are different decisions.

Authentication establishes identity under a defined mechanism. Authorization decides permitted actions and resources. Security also includes protecting data, secrets and interfaces against misuse throughout the request path; a login screen alone does not establish that protection.

What you’ll learn

  • Separate identity checks from object-level permission checks.
  • Evaluate session and resource-access decisions in visible scenarios.
  • Use established guidance and libraries for credentials, boundaries and failure tests.

Use established identity and session mechanisms

Use reviewed framework or identity-provider implementations instead of inventing password cryptography or token validation. If handling passwords, follow current storage guidance and suitable password-hashing implementations; do not store plaintext or use a general fast hash alone.

Protect credential transport, session creation, expiry and revocation under the application’s threat model. Browser sessions need appropriate cookie and request protections; bearer tokens need careful storage and validation of the intended trust boundary.

Multi-factor authentication can improve resistance to some account attacks, but does not replace permission checks or safe recovery flows. Rate limits, account recovery and error messages need deliberate abuse and privacy behaviour.

Check the specific action and resource on the server

A valid user identifier is not permission to read any order ID supplied by that user. Query or evaluate ownership, role and policy at the relevant server-side boundary. Default to denying access unless an explicit rule permits it.

Hiding a button in the browser can help the interface, but an attacker can send a request directly. The authoritative check must protect the operation regardless of which client calls it.

Services calling each other also need appropriate identity, permissions and input validation. A request arriving from an internal network is not proof that every requested operation is allowed.

Choose the enforcement boundary

Compare the consequences

Alice asks for an order that belongs to Bob.
Only staff should be able to delete a record.

Compare the visible consequences. With JavaScript enabled, choose an option in each scenario to assemble your decision record.

This is an exploratory design exercise. It does not run infrastructure, measure capacity or replace the lesson’s quiz.

All options and consequences remain visible. Select one option per situation to build a revisable decision record.

Explore two read-only permission scenarios. The cards describe the consequences of each design. This is a teaching review; it does not implement a production authentication system.

Any real implementation needs a threat model, suitable framework controls and tests for allowed and denied requests.

Minimise trust and sensitive exposure

Give application components the permissions they need for their responsibilities, rather than broad credentials for convenience. Keep secrets in appropriate protected configuration or secret-management systems, and plan rotation and revocation.

Validate inputs and use safe database and output APIs. Protect file uploads and outbound fetching according to their boundaries. A signed URL, proxy or cache must not bypass the resource’s actual access policy.

Collect useful audit outcomes while avoiding passwords, tokens and unnecessary personal data in logs. Test expiry, removed roles, logout and account changes rather than only successful sign-in.

Apply current primary guidance to the actual framework

The OWASP Authentication Cheat Sheet and Authorization Cheat Sheet provide implementation review guidance. Sources checked 6 October 2026. Use the selected framework’s current controls and library documentation as well.

For a small web application, a mature session-based framework may meet the need. An external identity provider can help shared identity or organisational requirements, while introducing integration, availability and commercial choices.

Choose identity mechanisms from the users, clients and threat model. “Use JWT” is not a complete decision about permissions, token theft, expiry or revocation.

Check your design decision

A token identifies Alice. Does that alone authorise reading Bob’s private order?
Choose one answer. You can try again.

Answer and explanation

No. The server must evaluate permission for that resource and action.

Authentication and authorization answer different questions.

Check your design decision

A staff-only button is hidden from ordinary users. Is that sufficient enforcement?
Choose one answer. You can try again.

Answer and explanation

No. The server must protect direct requests too.

The browser interface is not the authoritative permission boundary.

Check your design decision

Why use established credential and token-validation implementations?
Choose one answer. You can try again.

Answer and explanation

Their security contracts can be reviewed and maintained for the selected framework.

Correct credential handling has details that an improvised mechanism can miss.

Compare access wrappers and enforcement chains

A Proxy can mediate access and a request-check chain can organize enforcement. These structures must still check the protected resource on the server; a client wrapper cannot grant or revoke authority by itself.

Identity is one input to an access decision

Use mature authentication mechanisms and explicit server-side permission rules. Protect credentials, sessions, data and service boundaries together.

Follow current primary guidance, test denied and expired access, and keep sensitive values out of telemetry. Security requirements need implementation evidence, not architecture labels alone.

Reaching the recap and completing the quizzes are separate milestones.

    Next lesson: Disaster Recovery in System Design →