brace / mod-auth-basic
Http Basic authentication
Installs: 730
Dependents: 1
Suggesters: 0
Security: 0
Stars: 0
Watchers: 2
Forks: 0
Open Issues: 0
Type:project
Requires
- php: >=8.0
- brace/core: *
Requires (Dev)
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