Skip to content

Authentication vs Authorization

Authentication and authorization are the two pillars of access control. While often confused or conflated, they serve distinct purposes. Understanding this distinction is essential for designing secure systems.

AspectAuthenticationAuthorization
Question”Who are you?""What can you do?”
VerificationIdentityPermissions
TimingFirst (before authorization)Second (after authentication)
Failure Mode”I don’t know who you are""You’re not allowed to do that”
HTTP Status401 Unauthorized403 Forbidden

Authentication answers the question: “Who are you?”

It’s the process of verifying that someone is who they claim to be. Common authentication methods include:

  • Passwords
  • PINs
  • Security questions

Weakness: Can be guessed, phished, or stolen.

  • Hardware security keys (YubiKey)
  • Mobile authenticator apps
  • Smart cards

Weakness: Can be lost or stolen physically.

  • Fingerprints
  • Facial recognition
  • Voice patterns

Weakness: Cannot be changed if compromised.

Combining multiple factors dramatically increases security. An attacker must compromise multiple independent systems to gain access.

Single Factor: Password → Access
Multi-Factor: Password + TOTP + Security Key → Access
↑ ↑ ↑
Know Have Have (different device)

Authorization answers the question: “What are you allowed to do?”

After verifying identity, the system must determine what actions the authenticated user can perform. This involves:

Discretionary Access Control (DAC)

  • Resource owners grant permissions
  • Flexible but hard to audit
  • Example: File system permissions

Mandatory Access Control (MAC)

  • Central authority sets policies
  • Strict but less flexible
  • Example: Military classifications

Role-Based Access Control (RBAC)

  • Permissions assigned to roles
  • Users assigned to roles
  • Balances flexibility and control
  • Used by Rack Gateway

Attribute-Based Access Control (ABAC)

  • Policies based on attributes
  • Most flexible, most complex
  • Example: “Engineers can access prod during business hours”

Rack Gateway uses Google OAuth 2.0 for authentication:

  1. User clicks “Sign in with Google”
  2. Google verifies identity (password, MFA)
  3. Google returns user identity to Gateway
  4. Gateway creates a session token
Google OAuth → User Identity → Session Token → Authenticated Requests

The gateway itself never sees passwords—Google handles that responsibility.

Rack Gateway uses Role-Based Access Control for authorization:

  1. Each user has one or more roles
  2. Each role has specific permissions
  3. Each request requires certain permissions
  4. Gateway checks user’s roles against required permissions
User → Roles → Permissions → Allowed Actions
  1. Authentication: Alice signs in with Google OAuth

    • Google verifies Alice’s password and 2FA
    • Gateway receives: “This is alice@example.com
  2. Role Assignment: Gateway looks up Alice’s roles

    • Alice has role: operator
    • Operator role includes: convox:apps:list, convox:builds:create
  3. Authorization Check: Alice requests to deploy

    • Deploy requires: convox:releases:create
    • Alice’s permissions don’t include this
    • Result: 403 Forbidden
  4. Audit Log: Action recorded regardless of outcome

    • Who: alice@example.com
    • What: Attempted deploy
    • When: 2024-01-15 10:30:00
    • Result: Denied (insufficient permissions)

Wrong: “We have passwords, so we have security”

Right: Passwords provide authentication. You still need authorization to control what authenticated users can do.

Wrong: Checking permissions before verifying identity

Right: Always authenticate first, then authorize. You can’t grant permissions to an unknown identity.

Wrong: “They’re logged in, so they can do anything”

Right: Least privilege principle—only grant the minimum permissions needed.

Wrong: Only logging successful actions

Right: Failed authentication and authorization attempts are security signals. Rack Gateway logs everything.

Neither authentication nor authorization alone is sufficient:

ScenarioAuthentication OnlyAuthorization OnlyBoth
Compromised passwordAttacker has full accessN/A (no identity)Attacker limited to role permissions
Privilege escalationN/AAttacker can access anythingBlocked by role check
Insider threatTrusted user has full accessN/ALimited by principle of least privilege

Every user should have the minimum permissions necessary:

Admin: Full access (rare, audited)
Operator: Deploy apps, view logs (common)
Developer: Run commands, view output (most users)
Viewer: Read-only access (auditors, managers)

Critical actions should require multiple authorized users:

Developer creates deploy request → Operator approves → Deploy executes

Rack Gateway’s deploy approvals implement this pattern.

  1. Authentication proves identity—it answers “who are you?”
  2. Authorization grants permissions—it answers “what can you do?”
  3. Both are required for proper access control
  4. RBAC provides a practical balance of security and usability
  5. Audit logging captures both for compliance and forensics
  6. Least privilege limits damage from any single compromise
AspectImplementation
AuthenticationGoogle OAuth 2.0 with PKCE
Session ManagementSecure HTTP-only cookies
AuthorizationRole-based access control
RolesAdmin, Operator, Developer, Viewer
AuditEvery action logged with user attribution
MFATOTP, WebAuthn, YubiKey (step-up for sensitive actions)