laravel-adminer icon indicating copy to clipboard operation
laravel-adminer copied to clipboard

my session from another guard not working

Open dragonplunker opened this issue 3 years ago • 4 comments

i use auth as middleware but not working, whenever i access adminer route it keep kick me and cannot let me in

dragonplunker avatar Aug 08 '22 16:08 dragonplunker

@dragonplunker You may setup your own middleware groups

Please check v5.4.0 readme (https://github.com/onecentlin/laravel-adminer/tree/5.4.0)

onecentlin avatar Aug 08 '22 17:08 onecentlin

I've had the same issue when using only the default 'auth' middleware. In my case I also had to apply the 'web' middleware to the config/adminer.php file:

'middleware' => ['web', 'auth'],

Vinze avatar Jun 30 '23 13:06 Vinze

Hi @Vinze

If you are not using global middleware including \Illuminate\Session\Middleware\StartSession::class

I'll recommend you use middlewareGroups, you may adjust to fit your needs.

Checkout README - Setup Access Permission (Middleware)

config/adminer.php

'middleware' => 'adminer',

app/Http/Kernel.php

protected $middlewareGroups = [
    ...
    'adminer' => [
        \App\Http\Middleware\EncryptCookies::class,
        \Illuminate\Session\Middleware\StartSession::class,

        // Laravel default authentication (default protection)
        \Illuminate\Auth\Middleware\Authenticate::class,
    ],
];

onecentlin avatar Jun 30 '23 13:06 onecentlin

Hi @onecentlin,

I have updated from the version from Miroc to your version. I have a question regarding middleware. In the old setup I used:

Route::middleware('role:Administrator')->group(function () {
    /*
    |--------------------------------------------------------------------------
    | ADMINER
    |--------------------------------------------------------------------------
    */
    Route::any('adminer', [\Miroc\LaravelAdminer\AdminerAutologinController::class, 'index']);
});

That way it required the role of administrator to work. I am not sure how I can achieve the same thing with your setup. Can you provide some guidance?

schonhose avatar Jul 11 '23 17:07 schonhose