Help
Community
Project privacy set to public. By default, its content is available to everyone (authenticated or not). Please note that more restrictive permissions might exist on some items.
---- Authentication is the process of verifying who a user is before giving them access to a system, application, or API.
It ensures that only authorized users can log in or access protected resources.
authentication like a security guard checking your ID card before letting you enter a building.
How it work:
A user provides their credentials (like username & password).
The system checks if the credentials match stored records.
If correct, the user is granted access; otherwise, access is denied.
Password-Based Authentication (Basic Authentication)
Multi-Factor Authentication (MFA)
Token-Based Authentication (JWT, OAuth, API Key)
Biometric Authentication
Single Sign-On (SSO)
Certificate-Based Authentication
---- Authorization is the process of checking what a user is allowed to do after they have been authenticated.
Authentication: Security checks your ID card to verify you are an employee.
Authorization: Even if you’re an employee, you may not be allowed in the manager’s cabin. Your role (employee/manager) decides what areas you can access.
User logs in (authentication).
System checks their role or permissions.
Grants or denies access to specific resources.
Role-Based Access Control (RBAC)
Attribute-Based Access Control (ABAC)
Discretionary Access Control (DAC)
Mandatory Access Control (MAC)
Policy-Based Access Control (PBAC)
JWT (JSON Web Token) is a secure way to authenticate users in web applications.
It allows a server to verify a user’s identity without storing session data.
The client (browser, mobile app, or API consumer) receives a token and uses it to access protected resources.
User Logs In
The user sends a username and password to the server.
The server verifies the credentials in the database.
Server Generates a JWT Token
If the credentials are valid, the server creates a JWT token.
The token contains user details (like email or user ID).
The token is digitally signed using a secret key (to prevent tampering).
Client Stores the Token
The token is sent back to the user.
The user stores it (usually in local storage or session storage in the browser).
User Makes Requests with the Token
When the user makes a protected request, they send the token in the Authorization header:
Authorization: Bearer <JWT_TOKEN>
The server verifies the token.
If the token is valid, the user gets access to the protected resource.
-- HEADER.PAYLOAD.SIGNATURE
Header contains metadata about the token. ex: { "alg": "HS256", "typ": "JWT" }
Payload contains users data. ex: { "alg": "HS256", "typ": "JWT" }
Signature ensures token integrity. Encrypted string