Single Sign-On (SSO) in Cybersecurity - Time & Space Complexity
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?"