Authentication vs Authorization & Identity Management Foundations
Authentication verifies identity ('Who are you?'), whereas Authorization evaluates permissions ('What are you allowed to do?'). Understanding this distinction is the essential foundation of application security.
A. Introduction
Every modern web application—from university portals and social media networks to banking systems—must protect its resources and user data. To do this reliably, security systems split access control into two separate, sequential checkpoints: first confirming who is making the request, and then determining whether that person has permission to perform the requested action.
B. Authentication (AuthN)
Authentication is the process of verifying a user's identity. When you log in with your email and password, the server securely verifies the submitted password against the stored password hash to prove who you are.
Think of showing your passport at an airport. The officer checks your photo and passport details to confirm who you are before letting you proceed.
Common Authentication Methods:
C. Authorization (AuthZ)
Authorization is the process of deciding what an authenticated user is permitted to access or modify.
Why isn't authentication enough on its own? Because logging in only tells the application who you are, not what you should be allowed to touch. An intern and the company CEO can both log into the same corporate portal, but they should not have the same access permissions.
D. Authentication vs Authorization
Here is a quick side-by-side comparison to help you remember the difference:
| Feature | Authentication (AuthN) | Authorization (AuthZ) |
|---|---|---|
| Core Question | "Who are you?" | "What are you allowed to do?" |
| Primary Purpose | Verifies user identity | Determines access permissions |
| Order of Execution | Happens first | Happens second (after identity is known) |
| Real-World Analogy | Showing your passport at border control | Showing your boarding pass at the plane gate |
Who Can Access What?
Identity verified: Logged in as Employee.
Employee role has permission to edit team documents.
HTTP 200 OK (Access Granted): Employee is successfully authenticated and has the required authorization to edit documents.
E. How They Work Together (Alice's Scenario)
Let's trace what happens when an employee named Alice tries to access a sensitive billing spreadsheet:
Alice submits her credentials
Alice types her email and password into the company login page.
Identity is verified (Authentication)
The server securely verifies the submitted password against the stored password hash and confirms: "Yes, this is Alice."
Alice requests a restricted billing document
Alice clicks on the link: /company/finances/q3-billing.pdf.
The server checks permissions (Authorization)
The server looks at Alice’s role (Marketing Specialist) and compares it with the required permission (Finance Team).
Decision is rendered
Because Alice is not in Finance, the server denies access with an "Access Denied (403)" message. Alice is logged in, but not authorized for this specific file.
F. HTTP Status Codes: 401 vs 403
When an action fails, web servers use standard HTTP status codes to tell the client what went wrong. Understanding these two codes is essential for any developer:
Meaning: "We don't know who you are."
The request did not provide valid login credentials, or your session has expired. You need to log in first.
Meaning: "We know who you are, but you cannot touch this."
You are successfully authenticated, but your account or role does not have permission to view or edit this resource.
404 Not Found instead of 403 Forbidden. This is done to prevent attackers from discovering whether a sensitive document or endpoint exists.G. Common Misconceptions
H. Knowledge Check
Test your understanding with these 4 quick conceptual questions. Click an answer to check yourself!
When you unlock your smartphone using your fingerprint or entering a PIN, which security process is taking place?
An authenticated university student logs into the portal and tries to edit the exam grades of their classmates. Access is blocked. Which check stopped them?
Which HTTP status code should a server return when a user visits a private page without logging in at all?
True or False: If a user logs in successfully with a valid password, they should automatically have permission to access every page and database record in the application.