Single Sign-On (SSO) in Cybersecurity - Time & Space Complexity
Start learning this pattern below
Jump into concepts and practice - no test required
When using Single Sign-On (SSO), it's important to understand how the time to authenticate grows as more applications or users are involved.
We want to know how the system's work changes when more users or services use SSO.
Analyze the time complexity of the following simplified SSO authentication flow.
function authenticateUser(user, services) {
if (!validateUser(user)) {
return false;
}
for (let service of services) {
if (!checkAccess(user, service)) {
return false;
}
}
return true;
}
This code checks if a user is valid, then verifies access to each service in the list before granting SSO access.
- Primary operation: Looping through each service to check access.
- How many times: Once for each service the user wants to access.
As the number of services increases, the time to check access grows proportionally.
| Input Size (n = number of services) | Approx. Operations |
|---|---|
| 10 | 10 access checks |
| 100 | 100 access checks |
| 1000 | 1000 access checks |
Pattern observation: The work grows in a straight line as more services are checked.
Time Complexity: O(n)
This means the time to authenticate grows directly with the number of services checked.
[X] Wrong: "SSO authentication time stays the same no matter how many services are involved."
[OK] Correct: Each service requires an access check, so more services mean more work and longer time.
Understanding how authentication time grows with services helps you explain system performance clearly and shows you grasp real-world security challenges.
"What if the system cached access checks for services? How would that change the time complexity?"
Practice
Solution
Step 1: Understand SSO purpose
SSO allows users to log in once and access many apps without repeated logins.Step 2: Compare options
Only Log in once to access multiple applications without re-entering passwords describes this main benefit; others describe different security methods.Final Answer:
Log in once to access multiple applications without re-entering passwords -> Option CQuick Check:
SSO = Single login for many apps [OK]
- Confusing SSO with password rotation
- Thinking SSO requires multiple passwords
- Mixing SSO with two-factor authentication
Solution
Step 1: Identify SSO mechanism
SSO uses a single authentication that issues a token for other apps.Step 2: Eliminate incorrect options
Options B, C, and D describe separate logins or insecure practices, not SSO.Final Answer:
Users authenticate once and receive a token to access other apps -> Option BQuick Check:
SSO = One auth, token for others [OK]
- Thinking SSO requires multiple logins
- Confusing token with password
- Assuming password sharing is part of SSO
Solution
Step 1: Understand session token validity
The token is valid for 1 hour, so after 2 hours it expires.Step 2: Determine access after expiration
Without a valid token, access is denied until re-authentication.Final Answer:
Access is denied because the session token expired -> Option AQuick Check:
Expired token = no access [OK]
- Assuming one login lasts forever
- Confusing token expiration with password reset
- Thinking limited features are given after expiry
Solution
Step 1: Identify SSO failure reason
If users must log in repeatedly, tokens are likely not shared or recognized.Step 2: Evaluate other options
Password issues or cookie settings may affect login but token sharing is key for SSO.Final Answer:
SSO tokens are not shared properly between applications -> Option AQuick Check:
Token sharing failure = repeated logins [OK]
- Blaming user passwords instead of token issues
- Ignoring browser cookie settings
- Assuming different passwords cause SSO failure
Solution
Step 1: Identify security best practices with SSO
Strong passwords and multi-factor authentication protect the single login well.Step 2: Compare options for balance
Use SSO with strong passwords and multi-factor authentication combines ease (SSO) and strong security; others reduce usability or weaken security.Final Answer:
Use SSO with strong passwords and multi-factor authentication -> Option DQuick Check:
Strong auth + SSO = secure and easy [OK]
- Ignoring multi-factor authentication
- Thinking weak passwords are acceptable with SSO
- Believing manual approvals replace strong auth
