10 min read Identity & Access Architecture Identity (5 / 13)
Part 2 — Identity & Cryptography

Lesson 13.05 — Authentication & Authorization

Identity Proofing (AuthN) vs. Access Control (AuthZ), RBAC vs. ABAC Models, and Engineering Resilient Access Control

What You Will Master

By the end of this lesson, you will possess an engineering understanding of how modern applications verify identity and enforce granular access boundaries:

  • Authentication (AuthN) foundations, 3 credential factors & NIST guidelines
  • Authorization (AuthZ) architecture & the 4 pillars (Subject, Resource, Action, Policy)
  • Deep AuthN vs. AuthZ comparative matrix and HTTP 401 vs. 403 analysis
  • End-to-end web transaction lifecycle: from login hash verification to token authorization
  • Role-Based Access Control (RBAC): hierarchy strengths and the "Role Explosion" trap
  • Attribute-Based Access Control (ABAC): dynamic context-aware policy engines
  • 5 critical authorization flaws (BOLA/IDOR, Frontend-only checks, Default Allow)
  • Interactive 3-Tab Identity & Access Control Workbench (No Quiz)

1 Introduction: How Does a System Determine Who Can Do What?

Imagine opening an online mobile banking application. Upon launching the app, you provide your email address or phone number along with a secret password to log in. Once authenticated, your account dashboard appears: you can view your real-time balance, review your transaction history, and transfer funds to friends and family.

Now observe the same banking application from another perspective. A customer support agent at the bank's branch also logs into the system. When assisting a client, the agent can look up the client's KYC status or confirm a wire transfer reference number, but the agent cannot view the unmasked 16-digit debit card number or initiate withdrawals on the customer's behalf. Meanwhile, a cloud system administrator can configure network firewall rules, but has zero legitimate business permission to adjust customer account ledger balances.

Two Fundamental Questions of Every Secure System

Before any digital system can safely execute an incoming request, it must evaluate two entirely distinct questions:

Question 1: Who is the user really?

Is the requester genuinely the individual, device, or service they claim to be? This identity verification process is called Authentication (AuthN).

Question 2: What is the user permitted to do?

Once identity is established, does this user possess the legitimate authority to inspect, modify, or delete the target resource? This privilege enforcement process is called Authorization (AuthZ).

Real-World Analogy: Airport Passport vs. Boarding Pass

International airport travel provides an intuitive mental model for this architectural dichotomy:

Passport = Authentication (Identity Proof) The immigration officer inspects your government passport and matches your face to prove that you are genuinely John Doe. The passport verifies your Identity.
Boarding Pass = Authorization (Access Entitlement) Holding a valid passport does not grant you free entry into every plane on the runway or into the pilot's cockpit. The boarding pass proves you have purchased permission to board Flight 402 and sit in Seat 14B.

2 What is Authentication (AuthN) & How Does It Work?

Authentication is the process of verifying the claimed identity of a subject—whether that subject is an end-user, an automated microservice, an API client, or an IoT hardware node.

According to NIST SP 800-63 (Digital Identity Guidelines), when an entity seeks access, it presents an initial identity claim (e.g., "I am user alice@byteion.com"). The system accepts this claim only after the claimant presents valid authenticator credentials that only the genuine Alice should possess.

The 3 Classical Factors of Authentication

In cryptography and identity engineering, credentials are mathematically categorized into three foundational factors:

1. Something You Know
Knowledge Factor

Information stored solely within the user's memory. Examples include passwords, numeric PINs, secret passphrases, or security challenge answers.

Example: CorrectPass#2026
2. Something You Have
Possession Factor

A physical object or digital device under the user's custody. Examples include smartphone authenticator apps generating time-based one-time passwords (TOTP), SMS OTPs, FIDO2/WebAuthn hardware keys (YubiKey), or cryptographic smart cards.

Example: TOTP 6-digit code
3. Something You Are
Inherence Factor

Unique biological or physiological characteristics of the human being. Examples include capacitive fingerprint scans, 3D facial geometry (Face ID), iris patterns, and voiceprints.

Example: Touch ID / Face ID

The Standard Authentication Transaction Lifecycle

1. User Request Submits username & raw password over TLS
2. Auth Service Validates against salted hash (argon2/bcrypt)
3. Token Issuance Generates signed JWT or session cookie
4. Client Storage Attaches bearer token to subsequent API requests
Defensive Engineering Rule: When authentication fails, never return differentiated error messages like "Password is incorrect but username exists." Always respond with a generic message: "Invalid username or password" to prevent User Enumeration attacks.

3 What is Authorization (AuthZ) & How Does It Work?

Authorization is the process of determining whether an authenticated subject possesses the legitimate permission to perform a specific action on a designated system resource.

Completing authentication does not grant carte blanche authority. Logging in with valid credentials merely proves your identity; it does not grant you the right to read other customers' invoices or drop database tables. Every time an authenticated user interacts with an API endpoint or clicks a button, the backend server must verify: "Does this subject have the legal entitlement to access or mutate this exact object?"

The 4 Pillars of an Authorization Decision

As codified in NIST SP 800-162 and enterprise access control frameworks, every authorization decision evaluates 4 critical pillars:

1 Subject (Who is asking?)

The requesting entity attempting access. This can be an individual user, a background service worker, a microservice, or an administrative account.

subject.id = "user_rahim_101", role = "customer"
2 Resource (What target object is being accessed?)

The target entity upon which the operation is requested. Examples include an invoice PDF, an order row in a database, customer profile records, or server configurations.

resource.type = "Order", resource.id = "ord_7891"
3 Action (What operation is attempted?)

The verb defining the requested operation. In REST architectures, this maps to CRUD operations: Create, Read, Update, Delete, or specialized verbs like Approve or Export.

action = "READ" or "DELETE"
4 Policy (What security rules govern this access?)

The declarative rules written into system code or configuration files. Example: "A customer may read an order if and only if the order's owner ID equals the requester's ID."

allow IF resource.owner_id == subject.id

Real-World Roles & Permissions Matrix

User Role Permitted Actions Forbidden Actions Enforcement Policy Condition
Customer Browse catalog, create orders, view own order history. View other users' orders, alter product pricing, access administrative panels. owner_id == current_user.id
Support Staff View customer orders, update tracking status, issue authorized return labels. View unmasked credit card details, delete system databases, alter product inventory prices. user.role == 'staff' AND action == 'UPDATE_STATUS'
System Administrator Manage user roles, provision accounts, adjust system settings, inspect audit trails. View plaintext user passwords (passwords must always remain securely hashed). user.role == 'admin' WITH 2FA VERIFIED

4 Authentication vs. Authorization: Architectural Deep Dive

Although frequently conflated or used interchangeably in casual conversation, Authentication and Authorization perform completely different architectural duties. The table below outlines their exact differences:

Dimension Authentication (AuthN) Authorization (AuthZ)
Core Question "Who are you?" (Identity verification) "What are you allowed to do?" (Privilege verification)
Primary Purpose Verifying the genuine identity of a user or system entity. Enforcing access boundaries across protected system assets.
Execution Lifecycle Typically executed once per session upon initial login. Continuously evaluated on every single API call and operation.
Protocols & Mechanisms Passwords, Passkeys, TOTP MFA, WebAuthn, SAML 2.0, OpenID Connect (OIDC). RBAC, ABAC, OAuth 2.0 Scopes, Access Control Lists (ACLs), OPA / Cedar.
Generated Artifacts ID Tokens, Signed Session Cookies, cryptographic identity handles. Access Tokens, Scopes arrays, permission claims.
Failure Status Code 401 Unauthorized
(Historical misnomer for 401 Unauthenticated)
403 Forbidden
(Identity verified, but access is denied)
Interdependency Can occur independently of authorization (e.g., verifying user without granting specific privileges). Almost always relies on prior authentication to know who the subject is.

A Historical Standard Quirk: HTTP 401 vs. HTTP 403

The HTTP/1.1 specification contains a well-known linguistic inconsistency: when a client is missing valid credentials or sends an expired token, the server returns 401 Unauthorized. Technically, this should have been named 401 Unauthenticated! In contrast, when the server successfully verifies the user's identity but determines that the user lacks the permission to view the resource, it returns 403 Forbidden. Remembering this distinction is fundamental for secure API design.

5 How AuthN and AuthZ Work Together: End-to-End Workflow

Let us trace how modern web applications orchestrate both authentication and authorization in tandem during a realistic user workflow:

1
Login & Identity Verification (Authentication Phase)

Customer Rahim submits credentials to POST /api/login. The backend verifies the password against a cryptographic hash. Upon success, the server issues a cryptographically signed JSON Web Token (JWT) or an HttpOnly secure session cookie back to Rahim's client browser.

JWT Payload: { "sub": "user_rahim_101", "name": "Rahim", "role": "customer", "exp": 1735689600 }
2
Resource Request Dispatch (Client Request Phase)

Rahim navigates to view his past order history. The browser initiates an API call: GET /api/orders/7891. In every request, the client automatically attaches the credentials header: Authorization: Bearer <token>.

3
Permission & Ownership Verification (Authorization Phase)

The server's authentication middleware validates the token's cryptographic signature (AuthN check). It extracts the subject user_rahim_101. Next, the authorization policy queries the database for Order 7891 and checks ownership: order.customer_id == "user_rahim_101". The ownership check succeeds.

4
Decision Enforcement & Response Delivery (Access Decision)

Because both identity and ownership rules passed, the server responds with status 200 OK and the order payload. However, if Rahim had manually altered the URL to target Order 9940 (belonging to another customer, Karim), the ownership check would fail, prompting an immediate 403 Forbidden response.

6 Modern Access Control Models: RBAC vs. ABAC

To systematically enforce authorization across complex software ecosystems, engineers rely on standardized access control models. The two most dominant architectures in production today are RBAC and ABAC:

Model 1: RBAC

Role-Based Access Control

In RBAC, permissions are assigned to predefined Roles rather than directly to individual users. Users are assigned one or more roles, inheriting all privileges associated with that role.

Admin: User provisioning, system configuration, audit logs
Manager: Order approvals, financial summary reports
Employee: Complete assigned service tasks only
Key Advantage:

Intuitive to design, easy to audit, and mirrors organizational corporate hierarchies.

Limitation (Role Explosion):

Cannot evaluate dynamic conditions (e.g., "access allowed only during business hours"). Leads to thousands of hyper-specific roles (Role Explosion).

Model 2: ABAC

Attribute-Based Access Control

ABAC is a dynamic, next-generation model. Access decisions are evaluated at runtime by inspecting fine-grained Attributes across four distinct dimensions:

ABAC Policy Evaluation:

1. Subject: Department, clearance level, job title (e.g., Pediatric Doctor)

2. Resource: Classification label, owner, department (e.g., Confidential EMR)

3. Action: Operation type (e.g., Read medical chart)

4. Environment: Time of day, geographical IP, device posture (e.g., Hospital Intranet)

Key Advantage:

Highly granular, eliminates role explosion, and perfectly suited for Zero Trust cloud architectures.

Limitation:

Complex policy authoring and requires dedicated policy engines (e.g., Open Policy Agent - OPA, AWS Cedar).

7 5 Critical Authorization Mistakes & OWASP Top 10 Risks

Flawed access control is consistently ranked as the single most prevalent cause of catastrophic data breaches. In fact, Broken Object Level Authorization sits at #1 on the OWASP API Security Top 10. Let us examine the five most common pitfalls:

1. BOLA / IDOR (Broken Object Level Authorization)

An authenticated user modifies an identifier in an API call or URL to access another user's private data. For example, changing /api/user/1001/invoice to /api/user/1002/invoice returns Bob's private invoice because the backend never validated that Alice owns record 1002.

// Vulnerable: app.get('/orders/:id', (req, res) => db.getOrder(req.params.id));
// Hardened: app.get('/orders/:id', (req, res) => db.getOrder(req.params.id, req.user.id));
2. Client-Side Only Enforcement ("Security Through CSS")

Hiding an administrative "Delete" button in the React or HTML UI via style="display:none" or conditional frontend rendering, while leaving the backend API endpoint DELETE /api/users/12 completely unguarded. Any attacker using curl or Postman can bypass the UI and execute the deletion.

3. The "Logged In Equals Authorized" Fallacy

Assuming that because a user provided a valid JWT token signed by your auth server, they are permitted to invoke any system endpoint. Authentication verifies identity; it does not grant authorization. Every sensitive route must enforce permission checks.

4. Verifying Roles Without Resource Scoping

Code that merely checks if (user.role === 'customer') return true allows any customer to view or alter any other customer's shopping cart or shipping address. Roles alone are insufficient without resource ownership scoping.

5. Default Allow & Exception Bypasses

When access policies fail to find an explicit match or encounter an unhandled exception, failing open (granting access) introduces catastrophic risk. Always enforce Default Deny / Fail-Safe Defaults: access must be explicitly granted; otherwise, it is rejected.

Interactive Lab

Identity & Access Control Workbench

NO QUIZ · 3 TABS

Test authentication gates, simulate authorization policies, inspect OWASP access control flaws, and observe real-time audit decisions in this interactive security sandbox.

Configure Request Parameters:
Pipeline Execution & Audit Log 200 OK
✓
1. Authentication Gate (AuthN) Credentials and token signature verified. Subject: user_rahim_101
✓
2. Token Claims Extraction Token claims decoded: Sub=user_rahim_101, Role=customer
✓
3. Authorization Policy Gate (AuthZ) Ownership verification passed: Order owner ID matches requester ID.
// Security Kernel Log:

[AUTHZ_ALLOW] Access granted to order #7891. Subject rahim_101 authorized by ownership policy rule.

9 Lesson Summary: Core Takeaways

1. Identity vs. Privilege

Authentication verifies who you are (AuthN); Authorization governs what actions you can legally execute (AuthZ).

2. 3 Credential Factors

Something You Know (passwords), Something You Have (MFA tokens/phones), and Something You Are (biometrics).

3. 4 AuthZ Pillars

Every access decision evaluates Subject, Resource, Action, and Policy.

4. RBAC vs. ABAC

RBAC maps permissions to roles, while ABAC evaluates multi-dimensional contextual attributes at runtime.

5. Server-Side Enforcement

Hiding buttons in CSS or frontend frameworks is not security; every backend API route must enforce authorization.

6. Least Privilege & Default Deny

Provision the minimum necessary permissions, and strictly default to denying access when rules are undefined.

Authoritative References:

NIST SP 800-63-3 (Digital Identity Guidelines), NIST SP 800-162 (Guide to Attribute Based Access Control), OWASP Top 10 API Security - Broken Object Level Authorization (BOLA), and OWASP Authentication & Authorization Cheat Sheets.