feat: Add auth bypass feature for local dev

This commit is contained in:
Vincent BRIDIER 2025-10-24 12:15:01 +02:00
parent 5a25b0ba21
commit f3c97443a6
No known key found for this signature in database
GPG key ID: 8571BFA20420D512
2 changed files with 13 additions and 5 deletions

View file

@ -5,6 +5,7 @@ namespace App\Providers;
use Illuminate\Pagination\Paginator;
use Illuminate\Support\Carbon;
use Illuminate\Support\Facades\App;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\URL;
use Illuminate\Support\ServiceProvider;
@ -17,6 +18,12 @@ class AppServiceProvider extends ServiceProvider
*/
public function boot()
{
if (
in_array(config('app.env'), ['local', 'testing']) && config('app.bypassldap') && !app()->runningInConsole()
) {
Auth::loginUsingId(1);
}
// !!! Fuc**** Lab LDC exception OMG !!!
if (!in_array(config('app.env'), ['local', 'testing'])) {
URL::forceRootUrl(config('app.url'));
@ -26,11 +33,10 @@ class AppServiceProvider extends ServiceProvider
return $url->current();
});
}
// * LOCAL HTTPS FIX
if (!in_array(config('app.env'), ['local', 'testing'])) {
URL::forceScheme('https');
}
// * HA PROXY FIX
// * Force HTTPS
URL::forceScheme('https');
// * REVERSE PROXY FIX
App::singleton('clientIp', function () {
if (config('app.env') == 'local') {
return request()->getClientIp();

View file

@ -4,6 +4,8 @@ use Illuminate\Support\Facades\Facade;
return [
'bypassldap' => env('BYPASS_LDAP', false),
/*
|--------------------------------------------------------------------------
| Application Name