chore: 💥📦⬆️ Bump PHP to 8.3 + Add Laravel 11 compatibility + Change namespace for uwil compliance
This commit is contained in:
parent
5cf7ba3b45
commit
61efdb6099
10 changed files with 51 additions and 44 deletions
|
|
@ -1,8 +1,8 @@
|
|||
# LDC Web Admin Secure Laravel
|
||||
# Admin Secure Laravel
|
||||
|
||||
## Install on Laravel
|
||||
```
|
||||
composer req ldc/web-admin-secure-laravel
|
||||
composer req uwil/admin-secure-laravel
|
||||
```
|
||||
.env.example :
|
||||
|
||||
|
|
@ -24,7 +24,7 @@ php artisan schedule:run
|
|||
|
||||
## Available Commands
|
||||
```
|
||||
ldcweb:admin-secure-sync
|
||||
uwil:admin-secure:sync
|
||||
```
|
||||
## Usage
|
||||
Put 'admin-secure' middleware on route to protect it.
|
||||
|
|
|
|||
|
|
@ -1,5 +1,11 @@
|
|||
# Changelog
|
||||
|
||||
## **Version 3.0.0**
|
||||
|
||||
- Add Laravel 11 compatibility
|
||||
- Bump deps for Laravel 11
|
||||
- Change namespace for UWIL complience
|
||||
|
||||
## **Version 2.0.3**
|
||||
|
||||
- Add staging to environnements where sync command should be executed
|
||||
|
|
|
|||
|
|
@ -1,43 +1,44 @@
|
|||
{
|
||||
"name": "ldc/web-admin-secure-laravel",
|
||||
"name": "uwil/admin-secure-laravel",
|
||||
"description": "Restrict access to LDC Network",
|
||||
"license": "MIT",
|
||||
"version": "3.0.0",
|
||||
"authors": [
|
||||
{
|
||||
"name": "Vincent BRIDIER",
|
||||
"email": "vincent.bridier@ldc.fr",
|
||||
"name": "Equipe Web",
|
||||
"email": "equipe.web@ldc.fr",
|
||||
"homepage": "https://www.ldc.fr"
|
||||
}
|
||||
],
|
||||
"require": {
|
||||
"php": ">=8.2",
|
||||
"illuminate/support": "~10",
|
||||
"laravel/framework": "~10",
|
||||
"symfony/options-resolver": "^3.4.43|^4.4.30|^5.0.11|^6.0",
|
||||
"dxw/cidr": "^3.1"
|
||||
"php": "^8.3",
|
||||
"illuminate/support": "~11",
|
||||
"laravel/framework": "~11",
|
||||
"symfony/options-resolver": "^7.0",
|
||||
"dxw/cidr": "^3.2"
|
||||
},
|
||||
"require-dev": {
|
||||
"phpunit/phpunit": "^9",
|
||||
"phpunit/phpunit": "^11",
|
||||
"squizlabs/php_codesniffer": "^3",
|
||||
"orchestra/testbench": "^8",
|
||||
"slevomat/coding-standard": "^7",
|
||||
"phpunit/php-code-coverage": "^9",
|
||||
"larastan/larastan": "^2.6"
|
||||
"orchestra/testbench": "^9",
|
||||
"slevomat/coding-standard": "^8",
|
||||
"phpunit/php-code-coverage": "^11",
|
||||
"larastan/larastan": "^2.9"
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"LDC\\WebAdminSecureLaravel\\": "src/"
|
||||
"Uwil\\AdminSecure\\Laravel\\": "src/"
|
||||
}
|
||||
},
|
||||
"autoload-dev": {
|
||||
"psr-4": {
|
||||
"LDC\\WebAdminSecureLaravel\\Tests\\": "tests"
|
||||
"Uwil\\AdminSecure\\Laravel\\Tests\\": "tests"
|
||||
}
|
||||
},
|
||||
"extra": {
|
||||
"laravel": {
|
||||
"providers": [
|
||||
"LDC\\WebAdminSecureLaravel\\AdminSecureServiceProvider"
|
||||
"Uwil\\AdminSecure\\Laravel\\AdminSecureServiceProvider"
|
||||
]
|
||||
}
|
||||
},
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
|
||||
namespace LDC\WebAdminSecureLaravel;
|
||||
namespace Uwil\AdminSecure\Laravel;
|
||||
|
||||
use Dxw\CIDR\IPAddress;
|
||||
use Dxw\CIDR\IPv4Address;
|
||||
|
|
@ -11,8 +11,8 @@ use Illuminate\Http\Client\Response;
|
|||
use Illuminate\Support\Facades\Cache;
|
||||
use Illuminate\Support\Facades\Http;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use LDC\WebAdminSecureLaravel\Exceptions\AdminSecureException;
|
||||
use LDC\WebAdminSecureLaravel\Exceptions\AdminSecureInvalidAdressException;
|
||||
use Uwil\AdminSecure\Laravel\Exceptions\AdminSecureException;
|
||||
use Uwil\AdminSecure\Laravel\Exceptions\AdminSecureInvalidAdressException;
|
||||
|
||||
abstract class AdminSecure
|
||||
{
|
||||
|
|
@ -65,7 +65,7 @@ abstract class AdminSecure
|
|||
/**
|
||||
* Private options
|
||||
*
|
||||
* @var \LDC\WebAdminSecureLaravel\Options|null
|
||||
* @var \Uwil\AdminSecure\Laravel\Options|null
|
||||
*/
|
||||
private static $options = null;
|
||||
|
||||
|
|
@ -85,7 +85,7 @@ abstract class AdminSecure
|
|||
* Fetch client IP
|
||||
*
|
||||
* @return \Dxw\CIDR\IPv4Address|\Dxw\CIDR\IPv6Address
|
||||
* @throws \LDC\WebAdminSecureLaravel\Exceptions\AdminSecureException If the ip is invalid.
|
||||
* @throws \Uwil\AdminSecure\Laravel\Exceptions\AdminSecureException If the ip is invalid.
|
||||
*/
|
||||
public static function fetchClientIp(): IPv4Address|IPv6Address
|
||||
{
|
||||
|
|
@ -136,10 +136,10 @@ abstract class AdminSecure
|
|||
}
|
||||
|
||||
/**
|
||||
* Fetch Ip Adress list from LDC Web
|
||||
* Fetch Ip Adress list from Uwil Web
|
||||
*
|
||||
* @return array<\Dxw\CIDR\IPv4Address|\Dxw\CIDR\IPv6Address>
|
||||
* @throws \LDC\WebAdminSecureLaravel\Exceptions\AdminSecureException If Wrong env value.
|
||||
* @throws \Uwil\AdminSecure\Laravel\Exceptions\AdminSecureException If Wrong env value.
|
||||
* @throws \Illuminate\Http\Client\RequestException If calling admin secure fails.
|
||||
* @phpcs:disable Squiz.Commenting.FunctionCommentThrowTag.WrongNumber
|
||||
*/
|
||||
|
|
@ -192,7 +192,7 @@ abstract class AdminSecure
|
|||
*
|
||||
* @param array $ip_list
|
||||
* @return void
|
||||
* @throws \LDC\WebAdminSecureLaravel\Exceptions\AdminSecureInvalidAdressException If an IP is invalid.
|
||||
* @throws \Uwil\AdminSecure\Laravel\Exceptions\AdminSecureInvalidAdressException If an IP is invalid.
|
||||
*/
|
||||
private static function validateIpList(array $ip_list): void
|
||||
{
|
||||
|
|
@ -218,7 +218,7 @@ abstract class AdminSecure
|
|||
/**
|
||||
* Get Admin secure options
|
||||
*
|
||||
* @return \LDC\WebAdminSecureLaravel\Options
|
||||
* @return \Uwil\AdminSecure\Laravel\Options
|
||||
*/
|
||||
public static function getOptions(): Options
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,13 +1,13 @@
|
|||
<?php
|
||||
|
||||
namespace LDC\WebAdminSecureLaravel;
|
||||
namespace Uwil\AdminSecure\Laravel;
|
||||
|
||||
use Illuminate\Console\Scheduling\Schedule;
|
||||
use Illuminate\Contracts\Foundation\Application;
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
use Illuminate\Routing\Router;
|
||||
use LDC\WebAdminSecureLaravel\Console\SyncFromLDCWeb;
|
||||
use LDC\WebAdminSecureLaravel\Http\Middleware\AdminSecureMiddleware;
|
||||
use Uwil\AdminSecure\Laravel\Console\SyncFromLdcWeb;
|
||||
use Uwil\AdminSecure\Laravel\Http\Middleware\AdminSecureMiddleware;
|
||||
|
||||
class AdminSecureServiceProvider extends ServiceProvider
|
||||
{
|
||||
|
|
@ -23,7 +23,7 @@ class AdminSecureServiceProvider extends ServiceProvider
|
|||
], 'config');
|
||||
|
||||
// * Register the command if we are using the application via the CLI .
|
||||
$this->commands([SyncFromLDCWeb::class]);
|
||||
$this->commands([SyncFromLdcWeb::class]);
|
||||
|
||||
// * Set filter condition
|
||||
$this->app->singleton('hasToFilterIp', fn (Application $app) => $app->environment('production', 'staging'));
|
||||
|
|
@ -33,7 +33,7 @@ class AdminSecureServiceProvider extends ServiceProvider
|
|||
if ($this->app->make('hasToFilterIp')) {
|
||||
/** @var \Illuminate\Console\Scheduling\Schedule */
|
||||
$schedule = $this->app->make(Schedule::class);
|
||||
$schedule->command('ldcweb:admin-secure-sync')->daily();
|
||||
$schedule->command('uwil:admin-secure:sync')->daily();
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -1,23 +1,23 @@
|
|||
<?php
|
||||
|
||||
namespace LDC\WebAdminSecureLaravel\Console;
|
||||
namespace Uwil\AdminSecure\Laravel\Console;
|
||||
|
||||
use Illuminate\Console\Command;
|
||||
use LDC\WebAdminSecureLaravel\AdminSecure;
|
||||
use Uwil\AdminSecure\Laravel\AdminSecure;
|
||||
|
||||
/**
|
||||
* Send Report Status To LDC Web.
|
||||
*
|
||||
* @author Vincent BRIDIER <vincent.bridier@ldc.fr>
|
||||
*/
|
||||
class SyncFromLDCWeb extends Command
|
||||
class SyncFromLdcWeb extends Command
|
||||
{
|
||||
/**
|
||||
* The name and signature of the console command.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $signature = 'ldcweb:admin-secure-sync';
|
||||
protected $signature = 'uwil:admin-secure:sync';
|
||||
|
||||
/**
|
||||
* The console command description.
|
||||
|
|
@ -30,7 +30,7 @@ class SyncFromLDCWeb extends Command
|
|||
* Execute the console command.
|
||||
*
|
||||
* @return integer
|
||||
* @throws \LDC\WebAdminSecureLaravel\Exceptions\AdminSecureException If missing LDC_WEB_API_KEY key.
|
||||
* @throws \Uwil\AdminSecure\Laravel\Exceptions\AdminSecureException If missing LDC_WEB_API_KEY key.
|
||||
*/
|
||||
public function handle(): int
|
||||
{
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
|
||||
namespace LDC\WebAdminSecureLaravel\Exceptions;
|
||||
namespace Uwil\AdminSecure\Laravel\Exceptions;
|
||||
|
||||
class AdminSecureException extends \Exception
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
|
||||
namespace LDC\WebAdminSecureLaravel\Exceptions;
|
||||
namespace Uwil\AdminSecure\Laravel\Exceptions;
|
||||
|
||||
class AdminSecureInvalidAdressException extends AdminSecureException
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
|
||||
namespace LDC\WebAdminSecureLaravel\Http\Middleware;
|
||||
namespace Uwil\AdminSecure\Laravel\Http\Middleware;
|
||||
|
||||
use Closure;
|
||||
use Dxw\CIDR\IP;
|
||||
|
|
@ -9,7 +9,7 @@ use Dxw\CIDR\IPv4Range;
|
|||
use Dxw\CIDR\IPv6Address;
|
||||
use Dxw\CIDR\IPv6Range;
|
||||
use Illuminate\Http\Request;
|
||||
use LDC\WebAdminSecureLaravel\AdminSecure;
|
||||
use Uwil\AdminSecure\Laravel\AdminSecure;
|
||||
|
||||
class AdminSecureMiddleware
|
||||
{
|
||||
|
|
|
|||
|
|
@ -2,12 +2,12 @@
|
|||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace LDC\WebAdminSecureLaravel;
|
||||
namespace Uwil\AdminSecure\Laravel;
|
||||
|
||||
use Dxw\CIDR\IPv4Range;
|
||||
use Dxw\CIDR\IPv6Range;
|
||||
use Illuminate\Support\Facades\Cache;
|
||||
use LDC\WebAdminSecureLaravel\Exceptions\AdminSecureException;
|
||||
use Uwil\AdminSecure\Laravel\Exceptions\AdminSecureException;
|
||||
use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue