brace/mod-auth-basic

Http Basic authentication

Installs: 884

Dependents: 1

Suggesters: 0

Security: 0

Stars: 0

Watchers: 1

Forks: 0

Open Issues: 0

Type:project

pkg:composer/brace/mod-auth-basic

v1.0.0 2024-05-12 08:12 UTC

This package is auto-updated.

Last update: 2025-09-13 14:59:10 UTC


README

HTTP Basic Authentication

Example

Validate against closure function

$app->pipe->addMiddleWare(
    new AuthBasicMiddleware(new \Brace\Auth\Basic\Validator\LambdaAuthValidator(
        function (\Brace\Auth\Basic\BasicAuthToken $basicAuthToken) {
            return $basicAuthToken->user === "client1" && $basicAuthToken->passwd === "test";
        }
    ))
);

Validate against File

$app->pipe->addMiddleWare(
    new AuthBasicMiddleware(new ClientIdFileAuthValidator(CONFIG_PATH . "/clients.yml"))
);

Dont't forget to call

$basicAuthToken->validate();

To verify the Token is valid