What it is
Authentication establishes identity; authorization limits allowed actions. Least privilege gives only the access needed for the task. Defense in depth uses complementary controls so a failure at one boundary does not automatically expose everything.
Why you need it
A strong password does not prevent a valid user from exploiting excessive permissions. Controls should cover different failure modes rather than simply repeat the same check.
How it works
- Identify the user or service requesting access.
- Restrict its capabilities and resource scope.
- Protect credentials and monitor sensitive actions.
- Reassess access as roles, sessions, and needs change.
Permissions for a reporting service
Identity: reporting-worker
Allowed: read approved reporting views
Denied: change users, issue refunds, read credential tables
Credential: injected at runtime, rotated under policy
Evidence: access-denial tests and audited data exportsA service identity should not inherit broad administrator privileges merely because it runs on the backend. The precise permissions depend on the actual work it performs.
Good practices and why
- Use separate identities for different workloads and review permissions against current needs.
- Combine identity controls with resource authorization and useful audit evidence.
Common mistakes
- Assuming MFA prevents every form of session theft.
- Treating encryption as a replacement for access policy.
Try it yourself
Create a permission matrix for customer, support, and reporting-worker identities. Explain two denials that should remain even after successful authentication.
What a successful result looks like
Each identity receives only the actions and resource scope it needs, and sensitive exceptions are explicit.
0 / 6000 characters · Saved on this device. Do not include passwords or private data.
Check your understanding
Answer the understanding check correctly to record exercise completion.
Related interview practice
- The token is valid. The user logged out. ↗
- The API passes every positive test. ↗
- Rotate a credential without breaking active clients. ↗
These scenarios add constraints and follow-up questions to the concepts you just learned.
Further reading
Selected primary references · reviewed 2026-10-09. Examples are educational; use your framework’s documented integration guidance when building a deployed system.