public function authorize(ActionDispatchEvent $event)
    {
        $callable = $event->getCallable();

        if (!$callable->isMethod() && !$callable->isMethodStatic()) {
            // Native function or \Closure
            return;
        }

        $class = $callable->getReflection()->getDeclaringClass()->getName();
        $method = $callable->getReflection()->getName();
        $parameters = $event->getParameters();
        $action = $event->getAction();

        foreach ($action->getSecurityGroups() as $group) {
            $authorized = $this->authorizationChecker
                ->isGrantedMethodCall($class, $method, $parameters, [], $group);

            if (!$authorized) {
                throw new AccessDeniedException();
            }
        }
    }