0
0
Cybersecurityknowledge~5 mins

Single Sign-On (SSO) in Cybersecurity - Time & Space Complexity

Choose your learning style9 modes available
Time Complexity: Single Sign-On (SSO)
O(n)
Understanding Time 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.

Scenario Under Consideration

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.

Identify Repeating Operations
  • Primary operation: Looping through each service to check access.
  • How many times: Once for each service the user wants to access.
How Execution Grows With Input

As the number of services increases, the time to check access grows proportionally.

Input Size (n = number of services)Approx. Operations
1010 access checks
100100 access checks
10001000 access checks

Pattern observation: The work grows in a straight line as more services are checked.

Final Time Complexity

Time Complexity: O(n)

This means the time to authenticate grows directly with the number of services checked.

Common Mistake

[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.

Interview Connect

Understanding how authentication time grows with services helps you explain system performance clearly and shows you grasp real-world security challenges.

Self-Check

"What if the system cached access checks for services? How would that change the time complexity?"