protected function getServiceFromRequest(ServerRequestInterface $request)
    {
        $serviceAttribute = $this->getConfig('authorizationAttribute');
        $service = ($request->getAttribute($serviceAttribute));

        if (!$service instanceof AuthorizationServiceInterface) {
            $errorMessage = __CLASS__ . ' could not find the authorization service in the request attribute. ' .
                'Make sure you added the AuthorizationMiddleware before this middleware or that you ' .
                'somehow else added the service to the requests `' . $serviceAttribute . '` attribute.';

            throw new RuntimeException($errorMessage);
        }

        return $service;
    }