Open In App

Difference between Authentication and Authorization in LLD | System Design

When building computer programs, especially when designing complex systems, it’s super important to understand two key things: authentication and authorization. Even though these words sound similar, they do different jobs to keep our systems safe.



1. What is Authentication?

Authentication is a process used in system design to verify and confirm the identity of users or entities trying to access a computer system, application, or network. It ensures that only authorized individuals or systems are granted access, protecting sensitive information and resources from unauthorized use.



2. User Authentication in Low Level Design (LLD)

Here are the steps involved in planning or designing the authentication process:

Below is the explanation of the steps mentioned above:

  1. Authentication Section: Create a special part of the system just for checking if users are who they say they are.
  2. User Information: Decide where and how the software will keep things like usernames and passwords.
  3. Password Safety: Figure out how to keep passwords safe using special techniques.
  4. Login Management: Plan how the software will handle users logging in, including how long they can stay logged in.
  5. Extra Security Steps: Decide how to include extra security layers, like using a code sent to a user’s phone.
  6. Dealing with Mistakes: Plan what happens if someone tries to log in and makes a mistake, like limiting their attempts.
  7. Special Cases: If users forget their passwords, design a secure way for them to reset it.
  8. Connecting to Other Systems: If your system needs to work with other systems for login, decide how they will talk to each other.
  9. Protecting Against Attacks: Plan how to stop different types of attacks, like someone trying lots of passwords.
  10. Testing Everything: Create tests to make sure the login system works correctly and is secure.

3. Authentication Methods

3.1. Password-based Authentication:

3.2. Multi-Factor Authentication (MFA):

3.3. Biometric Authentication:

3.4. Token-based Authentication:

3.5. OAuth Connect:

4. How authentication information is passed between components in a low-level design

In a low-level design, authentication information is typically passed between components through various mechanisms. The exact method may depend on the architecture, technology stack, and specific requirements of the system. Here are common approaches:

5. Encryption in Authentication Processes

Encryption plays a crucial role in securing information during transmission and storage.

5.1. Secure Sockets Layer (SSL) / Transport Layer Security (TLS):

5.2. End-to-End Encryption:

6. Hashing in Authentication Processes:

Hashing is used to protect passwords and sensitive data by converting them into irreversible, fixed-length values.

6.1. Password Hashing:

6.2. Salting:

6.3. Checksums and Message Digests:

7. What is Authorization?

Authorization is the process of determining what actions or operations a user, system, or entity is allowed to perform within a software system or a network. It is a crucial aspect of security that ensures only authorized individuals or entities have access to specific resources, functionalities, or information.

8. User authorization in Low Level Design (LLD)

When implementing authorization in the Low-Level Design (LLD) phase of software development, you’re basically figuring out how the system decides who can do what. Here’s how you do it:

Below is the explanation of the steps mentioned above:

  1. Create an Authorization Module: Design a special part of the system that handles who gets permission to do certain things.
  2. Decide on Permission Structure: Figure out how permissions are structured—like who can access what—and how users or roles get these permissions.
  3. Choose Access Control Method: Decide whether you’re using Access Control Lists (ACLs) or Role-Based Access Control (RBAC) to manage access.
  4. Protect Resources: Plan how to safeguard important stuff (data, functions) based on who is allowed to access it.
  5. Context and Conditions: If needed, think about situations where access might change based on specific conditions, like the time of day or user location.
  6. Hierarchy and Roles: If applicable, design a system where higher-ups have control over permissions for those lower down in the hierarchy.
  7. Dynamic Changes: Plan for situations where permissions might change while the system is running.
  8. Keep Track of Actions: Design a way to keep a record of who accessed what, especially for security monitoring.
  9. Connect with Authentication: Make sure that the authorization part works closely with the authentication (login) system.
  10. Handle Errors: Decide what happens when someone tries to do something they’re not allowed to do—how does the system respond?
  11. Check Everything Works: Test the authorization system thoroughly to make sure it allows the right people to do the right things.

9. Authorization Models

After the authentication step, users want access to specific data to do their tasks. For this, they need authorization. Here are some common authorization methods:

9.1. Role-Based Access Control (RBAC):

9.2. Security Assertion Markup Language (SAML):

9.3. OpenID Authorization:

9.4. OAuth Authorization:

9.5. Device Permissions:

9.6. Location Permissions:

9.7. Mandatory Access Control (MAC):

10. Key Differences between Authentication and Authorization

Authentication

Authorization

In the authentication process, the identity of users are checked for providing the access to the system.

While in authorization process, a the person’s or user’s authorities are checked for accessing the resources.

In the authentication process, users or persons are verified. While in this process, users or persons are validated.
It is done before the authorization process. While this process is done after the authentication process.
It needs usually the user’s login details. While it needs the user’s privilege or security levels.
Authentication determines whether the person is user or not. While it determines What permission does the user have?
Generally, transmit information through an ID Token. Generally, transmit information through an Access Token.
The OpenID Connect (OIDC) protocol is an authentication protocol that is generally in charge of user authentication process.  The OAuth 2.0 protocol governs the overall system of user authorization process.

Popular Authentication Techniques-

  • Password-Based Authentication
  • Passwordless Authentication
  • 2FA/MFA (Two-Factor Authentication / Multi-Factor Authentication)
  • Single sign-on (SSO)
  • Social authentication

Popular  Authorization Techniques-

The authentication credentials can be changed in part as and when required by the user. The authorization permissions cannot be changed by user as these are granted by the owner of the system and only he/she has the access to change it.
The user authentication is visible at user end. The user authorization is not visible at the user end.
The user authentication is identified with username, password, face recognition, retina scan, fingerprints, etc.  The user authorization is carried out through the access rights to resources by using roles that have been pre-defined.

11.1. Authentication challenges and best practices:

11.2. Authorization challenges and best practices:

12. Impact of Authentication and Authorization on System Scalability and Performance

12.1. Authentication

12.2. Authorization

12.3. Balancing Act

13. Conclusion

When you’re designing a system, it’s super important to understand two big things: authentication and authorization.

By paying attention to these details when building a system, developers can make sure it’s not just good at confirming identities but also good at controlling who gets access to what. This helps a lot in preventing unauthorized actions and keeping data safe.


Article Tags :