Nowadays, software development is becoming increasingly complex and there are many information security threats. Keeping up with that trend, the Authentication vs Authorization mechanism was born to solve this problem, helping to improve the security of the software.
1. What is authentication? Some popular Authentication methods
1.1. Concept
Authentication is the process of authenticating user information and passwords to verify identity and verify whether the user has the right to access certain data or not.
1.2. Classify
Authentication includes two types: HTTP Basic Authentication and Multi-factor Authentication.
– HTTP Basic Authentication
HTTP Basic Authentication is a form of authentication to improve application security over the HTTP protocol. This form requires users to provide a login name and password when using the software. The server will collect user information on the browser to secure data.
– Multi-factor Authentication (MFA)
Multi-factor Authentication is a form of multi-factor authentication, a security system that requires multiple authentication steps including logging in or using other forms of transactions.
Multi-factor Authentication often combines factors such as passwords, security tokens, and biometric verification.
Combining many factors will create a solid security layer for the application, preventing intrusion from hackers.
1.3. Some popular Authentication methods
– Password
Password is the simplest and easiest to deploy Authentication method. The user will be asked to enter the password, then the system will save the information in a one-way encrypted form, ensuring that the password cannot be recovered even if it is hacked.
– Public electronic key
Public-key cryptography is an authentication method through an encryption algorithm using public key and private key. To access system resources, you need to have a personal key on your device and log in to the application without remembering your login information.
– Biology
Biometrics is an authentication method through fingerprints, faces, and other human biological factors. This method is often combined with an ID and password in case the user forgets.
2. User login storage mechanism
There are 3 basic user login storage mechanisms: Basic Authentication, Session-based Authentication, and Token-based Authentication.
2.1. Basic Authentication
Basic Authentication is the simplest authentication mechanism for web applications and is easily integrated automatically by many servers.
Advantage:
- Simple, compatible with most browsers and servers
- Easily combined with other methods such as methods using cookies, sessions, and tokens.
Disadvantage:
- Easy to reveal information about passwords and login names because each request must transmit a username and password.
- Required to save login information in the browser automatically, so users cannot log in.
- The interface is not user-friendly, making the user experience extremely boring.
2.2. Session-based Authentication
Session-based Authentication is an identity verification mechanism based on the server user’s session. After successful authentication, the server will save the user’s password and username.
For the server, the storage place is the database and files; For the client, the storage location is cookie memory, and website URL.
Advantage:
– Information is kept private:
The client only knows the session ID and does not know any user information during the transmission process.
– Small information transmission capacity:
Session ID does not carry user information but is only a special character string of about 20-50 characters, so each request has a small capacity and is easier to transmit.
– Does not affect the Client:
Using the Session-based Authentication user storage mechanism only requires you to edit information on the server side. The browser hardly processes any additional information but responds automatically.
Disadvantage:
– Takes up a lot of memory:
At each user request, the client creates a new session and stores it in memory. The increasing number of sessions will cause the application’s memory to overload.
– Difficulty in calculating data:
Because session data is stored on the server, you will have difficulty calculating application data.
– Depends on domain:
In some cases of verification through cookies, the cookie depends on the domain, so the user’s login will depend on the domain.
– Vulnerable to attack:
Session IDs are often saved in cookies, while cookies are vulnerable to hackers, making the application more vulnerable to attack.
2.3. Token-based Authentication
Token-based Authentication is an identity verification mechanism based on creating a character string containing user information created by the server and stored on the client’s computer.
Advantage:
– Stateless:
The token is self-storing, so the server does not need to store any information. This helps calculate horizontal application (horizontal scalability) without knowing the origin of the token.
– Suitable for a variety of clients:
Tokens can be easily stored and transmitted across a variety of clients, including web browsers, mobile applications, and IoT devices.
– Not limited by domain:
Using Token helps third parties operate more easily and does not depend on the domain like the mechanism of using cookies.
Disadvantage:
– Difficult to manage logout:
Because the server does not save any information about the user’s token or session, it makes it difficult to control logout.
– Information is easily exposed:
Information about the user’s login session is on the token and stored on the client side, so there is a risk of information disclosure during the transmission process.
3. What is Authorization? Some Authorization methods
3.1. Concept
Authorization is the process of determining access rights to data in the application for users. The authorization process occurs after the identification process to determine the level of permissions to use files, databases, applications, or other resources.
The purpose of Authorization is to allow users to exercise licensed rights, access resources with protected keys, and prevent attacks from unauthorized users.
3.2. Some Authorization methods:
– API Key
An API key is a form of authorization, usually associated with a specific application, to identify who is using the API key. The API consists of a public key and a private key, supporting communication between the server and the user.
– Basic authentication
Basic authentication is a form of authorization in which the user enters the login name and password in the header via HTTPS. Implementing basic HTTP authentication is the simplest method for controlling access to application resources.
– HMAC
HMAC is a code-based authorization process that authenticates messages through a digital signature algorithm. HMAC ensures only the sender and receiver have access to the security key to use resources in the application.
– OAuth
OAuth is a form of Authorization that allows Internet users to access application information without providing a password.
OAuth is a form applied by many large corporations such as Amazon, Google, Facebook, and Microsoft, helping users exchange information about their accounts with third-party applications.
4. Distinguish between Authentication vs Authorization
Authentication vs Authorization are two terms that are easily confused. However, they are two completely different concepts with a few differences such as:
Authentication | Authorization |
Authentication is the first step of Authorization. | Authorization is the step after successful Authentication. |
Authentication helps determine identity to grant access to the application. | Authorization helps define access rights to resources contained in the application. |
Usually requires a username and password | Depending on the security, different authentication factors will be required |
The authentication is displayed and the user can change the part | The authorization is not displayed and cannot be changed |
Conclude
Authentication and Authorization are two important aspects of software security. Authentication verifies user identity, while Authorization controls access. The flexible combination of these two elements helps businesses ensure system integrity and safety, creating a reliable software development environment.
Currently, BAP Software is one of the reputable information technology service companies, providing high-quality technology products to users, especially software services. If you need support and advice, please contact BAP Software immediately! We are always ready to support 24/24.