brace/mod-auth-basic

Http Basic authentication

Maintainers

Package info

github.com/brace-project/brace-mod-auth-basic

Homepage

Type:project

pkg:composer/brace/mod-auth-basic

Statistics

Installs: 915

Dependents: 1

Suggesters: 0

Stars: 0

Open Issues: 0

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

This package is auto-updated.

Last update: 2026-03-13 16:04:08 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