Dionera / laravel-beanstalkd-admin-ui

An Admin UI for Beanstalkd and Laravel

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Configuration middleware

devprojectsapps opened this issue · comments

Hi.
Now i have a problem with the middleware configuration.
We are using an AdminLTE Interface. The beanstalkd-admin-ui can only be reached if I have logged into our admin dashboard, like Laravel Horizon.
So i added this to the middleware array:

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

The problem is that everytime i want to open 'https://...../beanstalkd/tubes' i am landing on the Index Dashboard Page of our Admin Area and not in the beanstalkd/tubes dashboard.

If i use this configuration:

'middleware' => ['web'],

i can access the 'https://...../beanstalkd/tubes' without logged in our Admin Dashboard.
But thats not cool because everyone can access :-(

So what i am doing wrong?

Hard to tell without knowing what your admin middleware is doing. Are you being redirected to your admin dashboard or does the URL still point to /beanstalkd/tubes?

I am getting redirected to the admin dashboard URL.

Our Admin Middleware:

/**
 * Class Admin
 * @package recrudo\Http\Middleware
 * @deprecated
 */
class Admin
{
    /**
     * Handle an incoming request.
     *
     * @param  \Illuminate\Http\Request $request
     * @param  \Closure                 $next
     * @param  string|null              $guard
     *
     * @return mixed
     */
    public function handle($request, Closure $next, $guard = null)
    {
        if (!Auth::guard('admin')->check()) {
            if ($request->ajax() || $request->wantsJson()) {
                return response('Forbidden.', 403);
            }

            return response('Not Found.', 404);
        }

        return $next($request);
    }
}

Does this still happen if you remove the admin middleware and leave only auth? I'm trying to narrow down which middleware is actually redirecting you.

If i leave only auth i get this error:
...vendor/laravel/framework/src/Illuminate/Auth/AuthManager.php
InvalidArgumentException
Auth guard [web] is not defined.

Any chance you can set up a small repository that reproduces the error?

Closing due to inactivity. Feel free to reopen if you have more information.