link: Password-Based Authentication

Session-Cookie Authentication

Overview

Session-Cookie Authentication is a method used to maintain user sessions across multiple requests. This approach involves creating a session on the server side after a user logs in. The server stores session information and sends a session identifier (session cookie) to the client, which is included in subsequent requests to maintain the session.

How It Works

Pros/Cons

Best Practices

Recommendations

  • HttpOnly Cookies: Use HttpOnly cookies to prevent access to the cookie via JavaScript, mitigating the risk of XSS attacks.
  • Secure Cookies: Ensure cookies are marked as Secure to guarantee they are only sent over HTTPS connections.
  • Session Expiry: Implement session expiration and idle timeout mechanisms to enhance security.
  • Regenerate Session IDs: Regularly regenerate session IDs to prevent session fixation attacks.