Fixes route registration.

This commit is contained in:
Italo Baeza Cabrera
2022-10-28 17:00:52 -03:00
parent 73e0e6c8ee
commit 93d12d12c9
2 changed files with 23 additions and 15 deletions

View File

@@ -4,14 +4,17 @@ use App\Http\Controllers\WebAuthn\WebAuthnLoginController;
use App\Http\Controllers\WebAuthn\WebAuthnRegisterController; use App\Http\Controllers\WebAuthn\WebAuthnRegisterController;
use Illuminate\Support\Facades\Route; use Illuminate\Support\Facades\Route;
Route::middleware('web')->group(static function (): void { Route::middleware('web')
Route::post('webauthn/register/options', [WebAuthnRegisterController::class, 'options']) ->group(static function (): void {
->name('webauthn.register.options'); Route::controller(WebAuthnRegisterController::class)
Route::post('webauthn/register', [WebAuthnRegisterController::class, 'register']) ->group(static function (): void {
->name('webauthn.register'); Route::post('webauthn/register/options', 'options')->name('webauthn.register.options');
Route::post('webauthn/register', 'register')->name('webauthn.register');
Route::post('webauthn/login/options', [WebAuthnLoginController::class, 'options']) });
->name('webauthn.login.options');
Route::post('webauthn/login', [WebAuthnLoginController::class, 'login']) Route::controller(WebAuthnLoginController::class)
->name('webauthn.login'); ->group(static function (): void {
Route::post('webauthn/login/options', 'options')->name('webauthn.login.options');
Route::post('webauthn/login', 'login')->name('webauthn.login');
});
}); });

View File

@@ -32,13 +32,18 @@ class WebAuthn
public static function routes(): void public static function routes(): void
{ {
Route::middleware('web') Route::middleware('web')
->controller(\App\Http\Controllers\WebAuthn\WebAuthnRegisterController::class) ->group(static function (): void {
Route::controller(\App\Http\Controllers\WebAuthn\WebAuthnRegisterController::class)
->group(static function (): void { ->group(static function (): void {
Route::post('webauthn/register/options', 'options')->name('webauthn.register.options'); Route::post('webauthn/register/options', 'options')->name('webauthn.register.options');
Route::post('webauthn/register', 'register')->name('webauthn.register'); Route::post('webauthn/register', 'register')->name('webauthn.register');
});
Route::controller(\App\Http\Controllers\WebAuthn\WebAuthnLoginController::class)
->group(static function (): void {
Route::post('webauthn/login/options', 'options')->name('webauthn.login.options'); Route::post('webauthn/login/options', 'options')->name('webauthn.login.options');
Route::post('webauthn/login', 'login')->name('webauthn.login'); Route::post('webauthn/login', 'login')->name('webauthn.login');
}); });
});
} }
} }