protected function setupGuardMiddlewareMatch()
    {
        // should the middleware group match the guard name?
        $middlewareMatch = $this->app['config']->get('jwt.middleware_match', true);

        if ($middlewareMatch) {
            // when the route is actually matched...
            $this->app['router']->matched(function (RouteMatched $event) {

                // get the route middleware group.
                $middlewareGroup = Arr::first((array) $event->route->middleware());

                // if there is a group detected and  there is a guard that matches the middleware
                // group name...
                if ($middlewareGroup && !!$this->app['auth']->guard($middlewareGroup)) {
                    // setup the matching guard as default.
                    $this->app['auth']->setDefaultDriver($middlewareGroup);
                }
            });
        }
    }