protected function getAuthorizedResources($methods = null)
    {
        $resources = [];

        if ($this->auth instanceof Authentication) {
            $allow = (array) ($methods ?? $this->method);

            $authorizations = Authorization::dump(
                [
                    'user' => $this->auth->id,
                ],
                [
                    'resource',
                    'methods',
                    'filter',
                ]
            );

            foreach ($authorizations as $authorization) {
                $resource = $authorization['resource'];
                if (array_key_exists($resource, $this->resources)) {
                    if ($this->isPublic($resource, $methods)) {
                        $resources[$resource] = null;
                    } elseif (!empty(array_intersect(
                        $this->getAllowedMethods($resource),
                        array_merge(
                            $authorization['methods'] ?? [],
                            $allow
                        )
                    ))) {
                        $resources[$resource] = $authorization['filter'];
                    }
                }
            }
        } else {
            $resources = array_keys($this->resources);

            if ($this->auth === false) {
                foreach ($resources as $id => $resource) {
                    if (!$this->isPublic($resource, $methods)) {
                        unset($resources[$id]);
                    }
                }
            }

            $resources = array_fill_keys(array_values($resources), null);
        }

        return $resources;
    }