Audit vom 11.09. gegen HEAD geprüft, Entwicklungsplan dazu unter dev/2026-09-11-audit/ENTWICKLUNGSPLAN.md. Dieser Commit ist Deploy A: die sechs kleinen Punkte aus Block 1 ohne Schemaänderung. F01: Der Fortify-Endpunkt PUT /user/profile-information tauschte die E-Mail sofort und setzte die Verifizierung zurück; der Login-Sync vergab danach Firmenrechte allein nach E-Mail-Treffer. Feature abgeschaltet (die Kunden-UI hat den pending_email-Prozess), und der Sync verlangt jetzt ein verifiziertes, aktives Konto – für alle Aufrufer. F02: Google-Login übergibt Konten mit bestätigtem TOTP in die Challenge, wie Passwort- und Magic-Link-Login. F03: showRecoveryCodes ist gesperrt; ein Client-Update konnte die Recovery-Codes entschlüsseln lassen. F08: Nutzer-Detailroute unter can:users:manage (persistente Livewire- Middleware), Gutschriften autorisieren zusätzlich in der Action. F09: Gate::before greift nur für aktive Super-Admins; deaktivierte fallen auf die Gates mit is_active-Prüfung zurück. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
59 lines
2.2 KiB
PHP
59 lines
2.2 KiB
PHP
<?php
|
||
|
||
namespace App\Providers;
|
||
|
||
use App\Actions\Fortify\CreateNewUser;
|
||
use App\Actions\Fortify\ResetUserPassword;
|
||
use App\Actions\Fortify\UpdateUserPassword;
|
||
use App\Http\Responses\FailedTwoFactorChallengeResponse;
|
||
use App\Http\Responses\RoleAwareLoginResponse;
|
||
use Illuminate\Cache\RateLimiting\Limit;
|
||
use Illuminate\Http\Request;
|
||
use Illuminate\Support\Facades\RateLimiter;
|
||
use Illuminate\Support\ServiceProvider;
|
||
use Illuminate\Support\Str;
|
||
use Laravel\Fortify\Actions\RedirectIfTwoFactorAuthenticatable;
|
||
use Laravel\Fortify\Contracts\FailedTwoFactorLoginResponse;
|
||
use Laravel\Fortify\Contracts\LoginResponse;
|
||
use Laravel\Fortify\Contracts\TwoFactorLoginResponse;
|
||
use Laravel\Fortify\Fortify;
|
||
use Livewire\Volt\Volt;
|
||
|
||
class FortifyServiceProvider extends ServiceProvider
|
||
{
|
||
/**
|
||
* Register any application services.
|
||
*/
|
||
public function register(): void
|
||
{
|
||
$this->app->singleton(LoginResponse::class, RoleAwareLoginResponse::class);
|
||
$this->app->singleton(TwoFactorLoginResponse::class, RoleAwareLoginResponse::class);
|
||
// Fortifys Default leitet auf die nicht registrierte Route
|
||
// `two-factor.login` (views => false) – zurück zur Volt-Challenge.
|
||
$this->app->singleton(FailedTwoFactorLoginResponse::class, FailedTwoFactorChallengeResponse::class);
|
||
}
|
||
|
||
/**
|
||
* Bootstrap any application services.
|
||
*/
|
||
public function boot(): void
|
||
{
|
||
// Nur die notwendigen Fortify-Aktionen behalten
|
||
Fortify::createUsersUsing(CreateNewUser::class);
|
||
Fortify::updateUserPasswordsUsing(UpdateUserPassword::class);
|
||
Fortify::resetUserPasswordsUsing(ResetUserPassword::class);
|
||
Fortify::redirectUserForTwoFactorAuthenticationUsing(RedirectIfTwoFactorAuthenticatable::class);
|
||
|
||
// Keine View-Definitionen, da wir Volt verwenden
|
||
|
||
RateLimiter::for('login', function (Request $request) {
|
||
$throttleKey = Str::transliterate(Str::lower($request->input(Fortify::username())).'|'.$request->ip());
|
||
|
||
return Limit::perMinute(5)->by($throttleKey);
|
||
});
|
||
|
||
RateLimiter::for('two-factor', function (Request $request) {
|
||
return Limit::perMinute(5)->by($request->session()->get('login.id'));
|
||
});
|
||
}
|
||
}
|