intraset / laravel-basic-auth
Basic authentication using master credentials for the application.
v1.0.0
2023-10-06 16:09 UTC
Requires
- php: ^8.0
- illuminate/support: ^8.0|^9.0|^10.0
Requires (Dev)
- laravel/framework: ^10.0
- orchestra/testbench: ^8.12
- phpunit/phpunit: ^10.0
README
Basic authentication using master credentials for the application.
Installation
composer require intraset/laravel-basic-auth
Configuration
Publish the configuration file:
php artisan vendor:publish --provider="Intraset\LaravelBasicAuth\ServiceProvider"
Usage
Activate the middleware in the .env file:
BASIC_AUTH_ENABLED=true
Set the master credentials in the .env file:
BASIC_AUTH_USERNAME=admin BASIC_AUTH_PASSWORD=secret
Change the middleware alias in the .env file:
BASIC_AUTH_ALIAS=basic.auth
Change the middleware behavior to be applied to the application globally in the .env file:
BASIC_AUTH_GLOBAL=true
Change the middleware behavior to be applied to the middleware group in the .env file:
BASIC_AUTH_GROUP=web
Middleware
The middleware can be used in the following ways:
Route::get('/', function () { // })->middleware('basic.auth');
Testing
composer test
Credits
License
The MIT License (MIT). Please see License File for more information.