Apache HTTP Server Version 2.1

Apache > HTTP Server > Documentation > Version 2.1 > Modules

# Apache Module mod_auth_basic

Available Languages: en | ja | ko

Description: | Basic authentication
Status: | Base
Module Identifier: | auth_basic_module
Source File: | mod_auth_basic.c
Compatibility: | Available in Apache 2.1 and later

### Summary

This module allows the use of HTTP Basic Authentication to restrict access by looking up users in the given providers. HTTP Digest Authentication is provided by `mod_auth_digest`.

### Directives

### See also

- `AuthName`
- `AuthType`

## AuthBasicAuthoritative Directive

Description: | Sets whether authorization and authentication are passed to lower level modules
Syntax: | `AuthBasicAuthoritative On|Off`
Default: | `AuthBasicAuthoritative On`
Context: | directory, .htaccess
Override: | AuthConfig
Status: | Base
Module: | mod_auth_basic

Setting the `AuthBasicAuthoritative` directive explicitly to `Off` allows for both authentication and authorization to be passed on to lower level modules (as defined in the `modules.c` files) if there is no userID or rule matching the supplied userID. If there is a userID and/or rule specified, the usual password and access checks will be applied and a failure will give an "Authentication Required" reply.

So if a userID appears in the database of more than one module; or if a valid `Require` directive applies to more than one module; then the first module will verify the credentials; and no access is passed on; regardless of the `AuthBasicAuthoritative` setting.

By default control is not passed on and an unknown userID or rule will result in an "Authentication Required" reply. Not setting it thus keeps the system secure and forces an NCSA compliant behaviour.

## AuthBasicProvider Directive

Description: | Sets the authentication provider(s) for this location
Syntax: | `AuthBasicProvider On|Off|provider-name [provider-name] ...`
Default: | `AuthBasicProvider On`
Context: | directory, .htaccess
Override: | AuthConfig
Status: | Base
Module: | mod_auth_basic

The `AuthBasicProvider` directive sets which provider is used to authenticate the users for this location. Setting the value to `On` will choose the default provider (`file`). Since the `file` provider is implemented by the `mod_authn_file` module, you have to make sure, that the module is present in the server.

### Example

`<Location /secure>
AuthBasicProvider dbm
AuthDBMType SDBM
AuthDBMUserFile /www/etc/dbmpasswd
Require valid-user
</Location>`

See `mod_authn_dbm` and `mod_authn_file` for providers.

The value `Off` clears the provider list and sets it back to the default.

Available Languages: en | ja | ko