Introduction
Authentication vs Authorization
Introduction
Authentication and authorization answer two separate questions, and conflating them is where many access-control vulnerabilities begin.
Authentication asks: Who are you?
It establishes the identity of the requester using something such as a password, OTP, passkey, or valid session credential.
Authorization asks: What is that authenticated identity allowed to do?
Once the application knows who the requester is, it must determine whether that identity has permission to access the specific resource or perform the specific action being requested.
A simple flow looks like this:
Request
↓
Authentication
"Who is this?"
↓
Authenticated identity
↓
Authorization
"What may this identity do?"
↓
Allow / DenyThe critical point is that successful authentication does not imply authorization.
If the application only checks whether the user has a valid session and never checks their permissions, the authentication system can be perfectly secure while the authorization system is completely broken.
An attacker doesn't need to steal another user's password. They simply authenticate as themselves and request something they should never have access to.
Authentication: ✓
"I am user123."
Authorization: ✗
"user123 is allowed to access /admin."This is why authorization must be enforced at the point where the protected resource or action is accessed, not assumed merely because the user successfully logged in earlier.
Authentication establishes identity. Authorization determines permissions.