BasicAuthenticate (class)

Class BasicAuthenticate

Basic Authentication adapter for AuthComponent.

Provides Basic HTTP authentication support for AuthComponent. Basic Auth will authenticate users against the configured userModel and verify the username and passwords match.

Using Basic auth

In your controller's components array, add auth + the required config

public $components = [
     'Auth' => [
         'authenticate' => ['Basic']
     ]
 ];

You should also set AuthComponent::$sessionKey = false; in your AppController's beforeFilter() to prevent CakePHP from sending a session cookie to the client.

Since HTTP Basic Authentication is stateless you don't need a login() action in your controller. The user credentials will be checked on each request. If valid credentials are not provided, required authentication headers will be sent by this authentication provider which triggers the login dialog in th