mariovalney / laravel-keycloak-web-guard

Simple Keycloak Guard to Laravel Web Routes - https://packagist.org/packages/vizir/laravel-keycloak-web-guard
146 stars 80 forks source link

Call to undefined method Vizir\KeycloakWebGuard\Auth\Guard\KeycloakWebGuard::viaRemember() #46

Closed hatavoo closed 3 years ago

hatavoo commented 3 years ago

hello.

I use Laravel8 and jetstream. I'm trying to redirect to the dashboard , which is a secure page, after logging in with keycloak.

This is my route setting.

Route::group(['middleware' => 'keycloak-web'], function () {
    Route::get('/dashboard', function () {
        return view('dashboard');
    })->name('dashboard');
});
Route::get('/login', [\Vizir\KeycloakWebGuard\Controllers\AuthController::class, 'login'])->name('keycloak.login');
Route::get('/callback', [\Vizir\KeycloakWebGuard\Controllers\AuthController::class, 'callback'])->name('keycloak.callback');
Route::post('/logout', [\Vizir\KeycloakWebGuard\Controllers\AuthController::class, 'logout'])->name('keycloak.logout');

The callback method is working properly.

Call to undefined method Vizir\KeycloakWebGuard\Auth\Guard\KeycloakWebGuard::viaRemember()
vendor/laravel/framework/src/Illuminate/Session/Middleware/AuthenticateSession.php:42

How is it correct to resolve this error? I added this to the KeycloakWebGuard.php

    public function viaRemember()
    {
        return false;
    }

Thank you.

mariovalney commented 3 years ago

Hi!

Maybe you are including "AuthenticateSession" Middleware in request? It's not necessary and will throw this error.

You can check our example.

I created a PR to fix, but I'm not sure we should do it.

stale[bot] commented 3 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.