protected function getSession(Request $request) : Session\Session
    {
        $session = $request->getAttribute(SessionHandler::SESSION_ATTRIBUTE);

        if (! $session instanceof Session\Session) {
            throw new \Exception(
                'Session not available in request at: '
                . SessionHandler::SESSION_ATTRIBUTE
            );
        }
        return $session;
    }