Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 10 additions & 9 deletions .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,21 +10,22 @@ jobs:
test:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: true
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest]
php: [8.1]
laravel: [10.*]
stability: [prefer-lowest, prefer-stable]
os: [ubuntu-latest]
php: [8.2, 8.3]
include:
- laravel: 10.*
testbench: 8.0
- laravel: 11.*
testbench: ^9.0
- laravel: 12.*
testbench: ^10.0
stability: [prefer-stable]

name: P${{ matrix.php }} - L${{ matrix.laravel }} - ${{ matrix.stability }} - ${{ matrix.os }}
name: PHP ${{ matrix.php }} - Laravel ${{ matrix.laravel }} - ${{ matrix.stability }} - ${{ matrix.os }}

steps:
- name: Checkout code
uses: actions/checkout@v2
uses: actions/checkout@v4

- name: Setup PHP
uses: shivammathur/setup-php@v2
Expand Down
17 changes: 17 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,23 @@ All notable changes to `lockout` will be documented in this file

## [Unreleased]

## [6.0.0] - 2025-01-XX

### Added
- Laravel 11 and Laravel 12 Support
- PHP 8.2+ Support

### Fixed
- Fixed middleware logic bug where allow_login check was inside locked_types loop
- Fixed method case sensitivity issues in whitelist and locked_types handling
- Fixed pages array validation to handle non-array values gracefully
- Improved type hints and code quality

### Changed
- Updated PHPUnit to v11
- Updated PHPUnit configuration for PHPUnit 11 compatibility
- Improved test coverage with 11 additional test cases

## [5.0.0] - 2023-04-11

### Added
Expand Down
8 changes: 4 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@
}
],
"require": {
"php": "^8.1",
"illuminate/support": "^10.0"
"php": "^8.2",
"illuminate/support": "^11.0 || ^12.0"
},
"require-dev": {
"orchestra/testbench": "^8.0",
"phpunit/phpunit": "^9.5.10"
"orchestra/testbench": "^9.0 || ^10.0",
"phpunit/phpunit": "^11.0"
},
"autoload": {
"psr-4": {
Expand Down
90 changes: 90 additions & 0 deletions config/lockout.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,4 +55,94 @@
'whitelist' => [
// 'post' => 'password/confirm',
],

/*
|--------------------------------------------------------------------------
| IP Whitelist - Allow specific IP addresses to bypass lockout
|--------------------------------------------------------------------------
*/
'ip_whitelist' => env('LOCKOUT_IP_WHITELIST', ''),
'ip_whitelist_array' => [
// '127.0.0.1',
// '192.168.1.0/24',
],

/*
|--------------------------------------------------------------------------
| IP Blacklist - Block specific IP addresses even if lockout is disabled
|--------------------------------------------------------------------------
*/
'ip_blacklist' => env('LOCKOUT_IP_BLACKLIST', ''),
'ip_blacklist_array' => [
//
],

/*
|--------------------------------------------------------------------------
| Role-Based Exceptions - Allow specific user roles to bypass lockout
|--------------------------------------------------------------------------
*/
'allowed_roles' => [
// 'admin',
// 'super-admin',
],

/*
|--------------------------------------------------------------------------
| Custom Response - Customize the response when lockout is active
|--------------------------------------------------------------------------
*/
'response_type' => env('LOCKOUT_RESPONSE_TYPE', 'abort'), // 'abort', 'view', 'json'
'response_view' => 'lockout::maintenance',
'response_message' => 'Application is currently in read-only mode.',
'response_code' => 401, // HTTP_UNAUTHORIZED (backward compatible), use 503 for maintenance mode

/*
|--------------------------------------------------------------------------
| Route Patterns - Whitelist routes by pattern or route name
|--------------------------------------------------------------------------
*/
'route_patterns' => [
// 'api/*',
// 'health',
],
'route_names' => [
// 'health.check',
],

/*
|--------------------------------------------------------------------------
| API-Specific Handling
|--------------------------------------------------------------------------
*/
'api_enabled' => env('LOCKOUT_API_ENABLED', true),
'api_response_type' => 'json', // 'json', 'abort'
'api_response_message' => [
'message' => 'Application is currently in read-only mode.',
'status' => 'maintenance',
],

/*
|--------------------------------------------------------------------------
| Health Check Endpoint - Always accessible endpoint for monitoring
|--------------------------------------------------------------------------
*/
'health_check_enabled' => env('LOCKOUT_HEALTH_CHECK_ENABLED', true),
'health_check_path' => env('LOCKOUT_HEALTH_CHECK_PATH', 'health'),

/*
|--------------------------------------------------------------------------
| Cache Configuration
|--------------------------------------------------------------------------
*/
'cache_enabled' => env('LOCKOUT_CACHE_ENABLED', true),
'cache_key' => 'lockout.status',
'cache_ttl' => 60, // seconds

/*
|--------------------------------------------------------------------------
| Event System
|--------------------------------------------------------------------------
*/
'fire_events' => env('LOCKOUT_FIRE_EVENTS', true),
];
Loading