When you log into your email, how does the system know it's really you? And once you're in, how does it know you can read your own emails but not someone else's?
The answers to these questions lie in two of the most fundamental concepts in system security: Authentication and Authorization
While they sound similar and work together, they have distinct and critical roles.
In this chapter, we will break down these two pillars of access control, explaining what they are, how they differ, and how they are implemented in modern, secure systems.
In any system that involves users and data, access control is not just a feature, it's a foundational requirement. Without it, there's nothing to stop anyone from accessing sensitive information or performing destructive actions. This is where authentication and authorization come in.
Think of it like visiting a secure office building:
Both are essential. Without authentication, anyone can walk in. Without authorization, every authenticated employee could access the CEO's office. They are distinct but interdependent processes that form the bedrock of secure system design.
Authentication is the process of verifying a user's claimed identity. It answers the question, "Are you really who you say you are?" This is typically done by challenging the user to provide proof of their identity, which can come in several forms:
Modern systems often combine these through Multi-Factor Authentication (MFA) to increase security.
Type | Description | Example |
|---|---|---|
Basic Auth | Credentials (username/password) sent with every request. | Legacy APIs |
Session-Based Auth | Server issues session ID stored in cookies. | Traditional web apps |
Token-Based Auth (JWT) | Stateless tokens (e.g., JWT) passed in headers. | REST APIs |
OAuth 2.0 | Delegated access between services. | “Sign in with Google” |
Passwordless / Biometric | Email links or biometrics replace passwords. | Magic link login, Face ID |
Authorization is the process of determining whether an authenticated user has the necessary permissions to perform a specific action or access a particular resource. It happens after successful authentication and answers the question, "Is this user allowed to do this?"
Authorization decisions are made by an access policy engine based on a set of rules.
Model | Description | Example |
|---|---|---|
RBAC (Role-Based Access Control) | Permissions grouped into roles. | Admin, Editor, Viewer |
ABAC (Attribute-Based Access Control) | Access based on attributes like user, resource, or context. | “Allow if user.department == resource.department” |
PBAC (Policy-Based Access Control) | Uses declarative policies for fine-grained control. | AWS IAM, OPA |
admin, editor), and users are assigned to roles.DELETE /api/posts/123. The request includes their authentication token.userId: 5, roles: ['editor']).editor role have the delete:post permission?200 OK response or denies it and returns a 403 Forbidden error.Let's see how it all comes together.
Scenario: An editor logs into a blog platform and tries to delete a post.
userId: 10, role: 'editor'.DELETE /api/posts/42 request with the JWT in the Authorization header.role: 'editor' claim.editor role has the delete:post permission.204 No Content response. If the user had a viewer role, the server would have returned a 403 Forbidden error.