private function getTokenFromAuthorizationHeaders(ServerRequestInterface $request): ?string
    {
        $authorization_headers = $request->getHeader('AUTHORIZATION');

        foreach ($authorization_headers as $authorization_header) {
            if (1 === \Safe\preg_match('/'.\preg_quote('Bearer', '/').'\s([a-zA-Z0-9\-_\+~\/\.]+)/', $authorization_header, $matches)) {
                return $matches[1];
            }
        }

        return null;
    }