Menu

Authentication: Complete Definition and Guide

5 min read Mis à jour le 05 Apr 2026

Définition

Authentication is the process of verifying the identity of a user or system, ensuring that only authorised individuals access the protected resources of an application.

What is Authentication?

Authentication is the fundamental security mechanism that verifies a user is who they claim to be. It is the gateway to any protected system: before accessing their data, modifying settings, or performing sensitive actions, a user must prove their identity. This proof typically relies on one or more factors: something the user knows (password), possesses (phone, physical key), or is (fingerprint, facial recognition).

It is crucial to distinguish authentication from authorisation. Authentication answers the question "Who are you?" — it verifies identity. Authorisation answers "What are you allowed to do?" — it controls permissions. In a Django application, authentication is handled by the built-in auth system, while authorisation is managed through permissions and groups.

The evolution of authentication methods reflects the constant race between convenience and security. From the simple username/password pair, we have moved to multi-layered systems combining several verification factors, federated protocols enabling login via an existing account (Google, Microsoft), and passwordless approaches based on cryptographic keys (WebAuthn/Passkeys).

Why Authentication Matters

Authentication is the first line of defence for any web application. Weak or poorly implemented authentication exposes the entire system and its users to major risks.

  • Personal data protection: under GDPR, European companies have a legal obligation to protect their users' personal data. A robust authentication system is the first technical measure to implement.
  • Prevention of unauthorised access: brute force attacks, credential stuffing (using stolen credentials from other sites), and phishing are constantly increasing. Strong authentication with appropriate protection mechanisms is essential.
  • Regulatory compliance: beyond GDPR, many sectors (finance, healthcare, government) impose specific authentication requirements, such as strong authentication (MFA) for certain operations.
  • User trust: users are increasingly aware of security. Offering modern authentication methods (MFA, SSO, biometrics) strengthens trust in your application.
  • Traceability and auditing: authentication enables associating each action with an identified user, an essential condition for logging, auditing, and incident resolution.

How It Works

Password authentication, the most common method, follows a well-defined process. The user enters their identifier and password. The server retrieves the password hash stored in the database (never the plaintext password) and compares the hash of the submitted password with the stored hash. If the hashes match, the identity is verified, and the server creates a session. Django uses PBKDF2 with SHA-256 by default for password hashing, a deliberately slow algorithm that resists brute force attacks.

Multi-factor authentication (MFA) adds an additional security layer by requiring a second proof factor. After entering the password, the user must provide a temporary code (TOTP) generated by an authenticator app, a code received via SMS, or a confirmation via a physical key (FIDO2/WebAuthn). This approach makes accounts resistant to phishing and password theft.

Federated protocols like OAuth 2.0 and OpenID Connect allow a user to authenticate through a third-party identity provider (Google, Microsoft, GitHub). The application no longer manages passwords — it receives an identity token attesting that the provider has verified the user's identity. SSO (Single Sign-On) extends this concept by enabling a single login to access multiple applications within the same ecosystem.

Concrete Example

At KERN-IT, we implement authentication in Django applications by building on the built-in auth system, which we enrich as needed. For our Wagtail CMS, the admin interface uses the standard Django authentication system with server-side sessions. Users log in with their email and password, and middleware verifies the session on each request.

For our clients' business applications that require a higher security level, we add MFA authentication via TOTP (apps like Google Authenticator), enhanced password complexity policies, and login attempt limiting with temporary blocking. All communication is naturally encrypted via HTTPS, and session cookies are configured with Secure, HttpOnly, and SameSite attributes to prevent session hijacking.

Implementation

  1. Use Django's auth system: do not reinvent authentication. The django.contrib.auth module provides a proven system for managing users, passwords, and sessions.
  2. Configure password hashing: verify that Django's PASSWORD_HASHERS use secure algorithms (PBKDF2, bcrypt, Argon2). Never store passwords in plaintext or with weak hashes (MD5, SHA-1).
  3. Implement brute force protection: use packages like django-axes to limit login attempts and temporarily block IPs after excessive failures.
  4. Add MFA authentication: integrate a package like django-otp or django-mfa2 to offer two-factor authentication, at minimum for administrator accounts.
  5. Secure sessions: configure session cookies with SESSION_COOKIE_SECURE = True, SESSION_COOKIE_HTTPONLY = True, and SESSION_COOKIE_SAMESITE = 'Lax'.
  6. Implement secure password reset: use Django's password reset views with single-use tokens and limited validity duration.

Associated Technologies and Tools

  • Django Auth: authentication system built into Django, managing users, groups, and permissions.
  • OAuth 2.0 / OpenID Connect: standard protocols for federated authentication and authorisation delegation.
  • TOTP / FIDO2: standards for multi-factor authentication (authenticator apps, physical keys).
  • JWT (JSON Web Tokens): token format for stateless authentication in REST APIs.
  • HTTPS: essential prerequisite for protecting credentials in transit.
  • Argon2 / bcrypt: modern hashing algorithms recommended for passwords.

Conclusion

Authentication is the foundation of security for any web application. Rigorous implementation, based on proven standards and enriched by multi-factor authentication, effectively protects your users and data. At KERN-IT, we build every Django application with robust authentication from the start, leveraging Django's auth system, HTTPS encryption via Nginx, and OWASP best practices. Because the best feature in the world is worthless if anyone can access it without authorisation.

Conseil Pro

Enable multi-factor authentication (MFA) at minimum for all administrator accounts in your applications. It is the security measure with the best effort-to-impact ratio — it blocks over 99% of credential compromise attacks.

Un projet en tête ?

Discutons de comment nous pouvons vous aider à concrétiser vos idées.