laravel-littlegatekeeper

Protect pages from access with a universal username/password

  • 所有者: spatie/laravel-littlegatekeeper
  • 平台:
  • 許可證: MIT License
  • 分類:
  • 主題:
  • 喜歡:
    0
      比較:

Github星跟蹤圖

laravel-littlegatekeeper

Latest Version on Packagist
Software License
Build Status
Quality Score
Total Downloads

Protect pages from access with a universal username/password combination (set by configuration).

Spatie is a webdesign agency in Antwerp, Belgium. You'll find an overview of all our open source projects on our website.

Postcardware

You're free to use this package (it's MIT-licensed), but if it makes it to your production environment you are required to send us a postcard from your hometown, mentioning which of our package(s) you are using.

Our address is: Spatie, Samberstraat 69D, 2060 Antwerp, Belgium.

The best postcards will get published on the open source page on our website.

Install

You can install the package via Composer:

$ composer require spatie/laravel-littlegatekeeper

Start by registering the package's the service provider:

// config/app.php (L5)

'providers' => [
  // ...
  'Spatie\LittleGateKeeper\LittleGateKeeperServiceProvider',
],

Next, publish the config files:

$ php artisan vendor:publish --provider="Spatie\LittleGateKeeper\LittleGateKeeperServiceProvider" --tag="config"

Finally, register the middleware:

// app/Http/Kernel.php

protected $routeMiddleware = [
    // ...
    'littlegatekeeper' => \Spatie\LittleGateKeeper\AuthMiddleware::class,
];

Usage

First set up the username and password in your configuration file or .env file

In your .env file add:

// ...
GATEKEEPER_USERNAME=Choose_your_username
GATEKEEPER_PASSWORD=Choose_your_secret_password

You can protect your routes by applying the middleware:

Route::get('/', ['middleware' => 'littlegatekeeper', function () {
    return view('protectedpage');
}]);

If a user isn't logged in, he will be redirected to the url set in the config file (littlegatekeeper.authRoute).

Authenticator methods

/**
 * @param  array $credentials  Format: ['username' => '...', 'password' => '...']
 * @return bool
 */
public function attempt($credentials)
/**
 * @return bool
 */
public function isAuthenticated()
protected function logout()

Change log

Please see CHANGELOG for more information what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security

If you discover any security related issues, please email freek@spatie.be instead of using the issue tracker.

Credits

About Spatie

Spatie is a webdesign agency in Antwerp, Belgium. You'll find an overview of all our open source projects on our website.

License

The MIT License (MIT). Please see License File for more information.

概覽

名稱與所有者spatie/laravel-littlegatekeeper
主編程語言PHP
編程語言PHP (語言數: 1)
平台
許可證MIT License
發布數10
最新版本名稱2.0.3 (發布於 )
第一版名稱1.0.0 (發布於 )
創建於2015-06-11 10:24:21
推送於2024-03-25 08:29:55
最后一次提交
星數180
關注者數5
派生數21
提交數104
已啟用問題?
問題數6
打開的問題數0
拉請求數26
打開的拉請求數2
關閉的拉請求數12
已啟用Wiki?
已存檔?
是復刻?
已鎖定?
是鏡像?
是私有?
去到頂部