Skip to content

phutd-voyager/basic-auth

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Simple block blacklist and whitelist IP

PHP v8.2

Laravel v11.x

Installation

composer require voyager-inc/basic-auth
  • Publish provider
php artisan vendor:publish --provider="VoyagerInc\BasicAuth\ServiceProvider"

Usage

  • We have new middleware with the aliases basic-auth
return [
    'enabled' => env('BASIC_AUTH_ENABLED', true), // 'true' to enable, 'false' to disable
    'username' => 'admin', // config username
    'password' => 'password', // config password
    'error_message' => 'Unauthorized', // custom error message
    'headers' => [ // config headers
        'WWW-Authenticate' => 'Basic realm="Sample Private Page"',
        'Content-Type' => 'text/plain; charset=utf-8'
    ],
];
  • Example
Route::get('/test', function () {
    return 'basic auth route';
})->middleware(['basic-auth']);

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages