Drupal is a registered trademark of Dries Buytaert
drupal 11.3.7 Update released for Drupal core (11.3.7)! drupal 11.2.11 Update released for Drupal core (11.2.11)! drupal 10.6.7 Update released for Drupal core (10.6.7)! drupal 10.5.9 Update released for Drupal core (10.5.9)! cms 2.1.1 Update released for Drupal core (2.1.1)! drupal 11.3.6 Update released for Drupal core (11.3.6)! drupal 10.6.6 Update released for Drupal core (10.6.6)! cms 2.1.0 Update released for Drupal core (2.1.0)! bootstrap 8.x-3.40 Minor update available for theme bootstrap (8.x-3.40). menu_link_attributes 8.x-1.7 Minor update available for module menu_link_attributes (8.x-1.7). eca 3.1.1 Minor update available for module eca (3.1.1). layout_paragraphs 2.1.3 Minor update available for module layout_paragraphs (2.1.3). ai 1.3.3 Minor update available for module ai (1.3.3). ai 1.2.14 Minor update available for module ai (1.2.14). node_revision_delete 2.0.3 Minor update available for module node_revision_delete (2.0.3). moderated_content_bulk_publish 2.0.52 Minor update available for module moderated_content_bulk_publish (2.0.52). klaro 3.0.10 Minor update available for module klaro (3.0.10). klaro 3.0.9 Minor update available for module klaro (3.0.9). layout_paragraphs 2.1.2 Minor update available for module layout_paragraphs (2.1.2). geofield_map 11.1.8 Minor update available for module geofield_map (11.1.8).

The WWW Authenticate module is a highly flexible security suite for Drupal 10 and 11, designed to provide a robust HTTP-level authentication gate. It acts as a dynamic, database-driven alternative to static server-level .htpasswd files, allowing for seamless integration with Drupal's internal permissions, path systems, and network rules. Whether you need to shield a staging site or protect specific sensitive routes, this module provides granular control without touching server configurations.

Key Features

  • Multi-Credential Support: Manage multiple username and password pairs independently of Drupal’s core user table for different stakeholders, clients, or automated services.
  • Granular Path Scoping: Protect the entire site (Exclude mode) or target specific sensitive routes (Include mode) using Drupal's native path matcher.
  • Advanced IP Filtering: Integrated allowlist and denylist logic supporting exact IPs, CIDR ranges (e.g., 192.168.1.0/24), and wildcards (e.g., 10.0.*).
  • Temporal Restrictions: Automatically enable or disable authentication based on business hours, specific days of the week, and configurable timezones.
  • Identity-Based Bypass: Allow logged-in Drupal users with specific roles to skip the HTTP Basic Auth prompt entirely, streamlining the workflow for authenticated team members.
  • Admin Lockout Protection: Hardcoded exclusions for configuration and log paths ensure administrators can always access the settings even if rules are misconfigured.

Installation

Install the module via Composer to ensure core dependencies and database schema definitions are correctly mapped:

composer require drupal/www_authenticate

Enable the module using Drush:

drush en www_authenticate -y

Configuration & Permissions

After installation, follow these steps to secure your site:

  1. Navigate to People » Permissions.
  2. Grant "Administer WWW Authenticate" to manage credentials and access rules.
  3. Grant "Access WWW Authenticate Logs" to users who need to monitor authentication history.
  4. Go to Configuration » System » WWW Authenticate (/admin/config/system/www-authenticate) to define your security rules.

Architecture & Logic

The module operates as a high-priority middleware layer within the Drupal kernel to ensure maximum security with minimal overhead:

  • Middleware Layer: Hooks into KernelEvents::REQUEST at the earliest stage to intercept requests before the routing system fully resolves.
  • WwwAuthenticate Service: A centralized logic handler that performs real-time IP matching, CIDR calculations, and path validation.
  • Smart Bypasses: Includes built-in toggles to allow Drush, Cron, and JSON:API/REST requests to function without manual authentication headers.
  • Pruning Engine: Automatically maintains database health by trimming logs based on user-defined entry limits to prevent table bloat.

Troubleshooting

If you encounter issues during setup, consider the following:

  • Emergency Access: If you accidentally lock yourself out, use the Drush command drush www-authenticate:disable to immediately drop the shield.
  • IP Precedence: If an IP address exists in both the Allowlist and Denylist, the Allowlist takes precedence.
  • Path Matching: Ensure you are using internal Drupal paths. The module automatically normalizes patterns like node/ and /node/ for consistency.

Similar projects

Supporting this Module

If you find this module helpful or have suggestions for new features, please contribute to the issue queue. Your feedback helps keep this tool robust for the community!

Activity

Total releases
2
First release
Feb 2026
Latest release
1 month ago
Release cadence
0 days
Stability
50% stable

Releases

Version Type Release date
2.0.0 Stable Feb 19, 2026
2.0.x-dev Dev Feb 19, 2026