notes
notes
Access**
1. **Pre-Industrial Societies**:
- Authentication was implicit, relying on trust and recognition within
communities. Deals were sealed with handshakes, symbolizing mutual recognition.
- This system faltered as societies grew and interactions extended beyond
familiar circles, necessitating explicit forms of authentication.
2. **Medieval Period**:
- The introduction of seals served as an early form of cryptographic
authentication. Unique wax seals functioned as tokens of identity but were
vulnerable to forgery, prompting further innovation.
5. **Cryptographic Advances**:
- The 1970s saw breakthroughs like the Diffie-Hellman key exchange, enabling
asymmetric cryptography—the backbone of modern authentication protocols.
- Protocols like Kerberos introduced ticket-based authentication, paving the way
for token-based systems.
- **Overview**:
- Sessions provide temporary server-side context for users. A session ID,
generated upon login, is stored server-side and sent to the client as a cookie.
- **Evolution**:
- Early sessions used file-based storage but shifted to databases and distributed
in-memory stores like Redis for scalability.
#### **2. JSON Web Tokens (JWTs)**
- **Key Features**:
- JWTs are stateless tokens containing encoded user data, metadata, and a
cryptographic signature.
- They eliminate the need for server-side storage of session data, improving
scalability.
- **Structure**:
- **Header**: Contains metadata, like the signing algorithm.
- **Payload**: Stores user-specific information (e.g., user ID, roles).
- **Signature**: Ensures the token’s integrity and authenticity.
- **Challenges**:
- Token revocation is complex, and compromised tokens remain valid until
expiration. Hybrid approaches combining statelessness with stateful mechanisms
(e.g., blacklists) address these issues.
- **Purpose**:
- API keys facilitate machine-to-machine communication. They are used to
authenticate requests from one server to another, bypassing human interaction.
- **Use Cases**:
- Ideal for programmatic access to APIs, such as integrating external services.
- **OAuth 2.0**:
- Addresses the delegation problem by allowing users to grant third-party apps
access to specific resources without sharing passwords.
- Examples include granting a travel app access to Gmail for flight details or a
social media app access to Google Contacts.
- **OpenID Connect**:
- Extends OAuth 2.0 by introducing ID tokens (JWTs) for authentication, enabling
features like "Sign in with Google."
- **Definition**:
- Authorization determines the actions a user can perform. For example, users may
create or delete notes, while administrators can access and modify "Dead Zone"
notes.
- **RBAC Workflow**:
- Users are assigned roles (e.g., user, admin) with predefined permissions.
- Upon request, the server checks the user’s role to determine access levels.
1. **Error Messaging**:
- Avoid exposing specific details (e.g., "User not found" or "Incorrect
password") to prevent attackers from identifying valid usernames or passwords. Use
generic messages like "Authentication failed."
### **Conclusion**