Authentication is the process of verifying who a user is. It checks the user's identity, usually by asking for credentials like username and password.
Click to reveal answer
beginner
What does authorization mean in system design?
Authorization is the process of checking what a user is allowed to do. It controls access to resources based on user permissions.
Click to reveal answer
beginner
How are authentication and authorization different?
Authentication answers "Who are you?" while authorization answers "What can you do?" Authentication happens before authorization.
Click to reveal answer
beginner
Give a real-life example of authentication and authorization.
Logging into your email is authentication (proving who you are). Being able to read emails but not change account settings is authorization (what you can do).
Click to reveal answer
intermediate
Why is it important to separate authentication and authorization?
Separating them helps keep systems secure and organized. Authentication confirms identity once, then authorization controls access many times based on that identity.
Click to reveal answer
Which process verifies a user's identity?
AAuthentication
BAuthorization
CEncryption
DData validation
✗ Incorrect
Authentication is the process of verifying who a user is.
What does authorization control?
APassword strength
BUser identity
CUser permissions
DNetwork speed
✗ Incorrect
Authorization controls what a user is allowed to do based on permissions.
Which happens first in a secure system?
AAuthorization
BAuthentication
CData backup
DLogging out
✗ Incorrect
Authentication happens before authorization to confirm user identity.
If a user can log in but cannot access admin pages, what is this an example of?
AAuthentication failure
BData corruption
CNetwork error
DAuthorization restriction
✗ Incorrect
The user is authenticated but restricted by authorization rules.
Which of these is NOT part of authentication?
ARole assignment
BFingerprint scan
CPassword check
DTwo-factor verification
✗ Incorrect
Role assignment is part of authorization, not authentication.
Explain the difference between authentication and authorization with an example.
Think about logging into a website and what you can do after logging in.
You got /3 concepts.
Why should authentication and authorization be handled separately in system design?
Consider what happens if you mix verifying identity and checking permissions.
You got /3 concepts.
Practice
(1/5)
1. Which of the following best describes authentication in system design?
easy
A. Encrypting user data
B. Granting access to resources
C. Logging user activities
D. Verifying the identity of a user
Solution
Step 1: Understand authentication purpose
Authentication is the process of confirming who the user is by checking credentials like username and password.
Step 2: Differentiate from authorization
Authorization controls what the user can do after identity is confirmed, not the identity check itself.
Final Answer:
Verifying the identity of a user -> Option D
Quick Check:
Authentication = Verifying identity [OK]
Hint: Authentication = Who you are, Authorization = What you can do [OK]
Common Mistakes:
Confusing authentication with authorization
Thinking authentication controls permissions
Mixing identity verification with data encryption
2. Which of the following is a correct example of an authorization check in code?
easy
A. if user.password == input_password:
B. if user.session_token is not None:
C. if user.role == 'admin':
D. if user.email_verified:
Solution
Step 1: Identify authorization logic
Authorization checks what actions a user can perform, often by checking roles or permissions like user.role == 'admin'.
Step 2: Differentiate from authentication checks
Authentication checks credentials like passwords or tokens, not roles.
Final Answer:
if user.role == 'admin': -> Option C
Quick Check:
Authorization checks roles/permissions [OK]
Hint: Authorization checks roles or permissions, not passwords [OK]
Common Mistakes:
Using password checks as authorization
Confusing session token presence with authorization
Checking email verification as authorization
3. Consider this code snippet:
def access_resource(user):
if not user.is_authenticated:
return "Access Denied"
if user.permission != 'read':
return "Permission Denied"
return "Resource Content"
What will be the output if user.is_authenticated is True but user.permission is 'write'?
medium
A. "Permission Denied"
B. "Resource Content"
C. "Access Denied"
D. Error due to missing permission
Solution
Step 1: Check authentication condition
The user is authenticated (True), so the first if condition fails and does not return "Access Denied".
Step 2: Check authorization condition
The user's permission is 'write', which is not equal to 'read', so the second if returns "Permission Denied".
Final Answer:
"Permission Denied" -> Option A
Quick Check:
Authenticated but wrong permission = Permission Denied [OK]
Hint: Authenticated? Check permission next for authorization [OK]
Common Mistakes:
Ignoring permission check and returning resource
Confusing authentication failure with permission failure
Assuming 'write' permission equals 'read'
4. A developer wrote this code to check access:
if user.is_authorized:
print("Access granted")
else:
print("Access denied")
But the system always denies access even for valid users. What is the likely issue?
medium
A. The variable is_authorized is misspelled
B. The code checks authorization without authenticating the user first
C. The print statements are reversed
D. The user object is not defined
Solution
Step 1: Analyze authentication and authorization order
Authorization should only be checked after confirming the user is authenticated. Skipping authentication can cause authorization to fail.
Step 2: Understand why access is always denied
If is_authorized depends on authentication, but authentication is missing, it will always be false or unset, denying access.
Final Answer:
The code checks authorization without authenticating the user first -> Option B
Quick Check:
Authenticate before authorizing [OK]
Hint: Always authenticate before authorization checks [OK]
Common Mistakes:
Checking authorization without authentication
Assuming authorization implies authentication
Ignoring user object initialization
5. In designing a secure web service, which approach correctly applies authentication and authorization to protect user data?
hard
A. Authenticate users with passwords, then authorize access based on roles before serving data
B. Authorize users first, then authenticate them before data access
C. Allow data access after authentication without any authorization checks
D. Skip authentication if the user has a valid session token
Solution
Step 1: Understand correct security flow
First, confirm user identity by authentication (e.g., passwords). Then, check what the user is allowed to do by authorization (e.g., roles).
Step 2: Evaluate options for security best practice
Authenticate users with passwords, then authorize access based on roles before serving data follows the correct order: authenticate then authorize. Other options either reverse order, skip authorization, or skip authentication improperly.
Final Answer:
Authenticate users with passwords, then authorize access based on roles before serving data -> Option A
Quick Check:
Authenticate first, then authorize [OK]
Hint: Authenticate identity first, then authorize actions [OK]
Common Mistakes:
Reversing authentication and authorization order
Skipping authorization after authentication
Trusting session tokens without authentication
Recommended
Ready to prove it?
Pass the test and this pattern moves unknownstrongwhile earning +1 Grip toward your certificate.