public function parseRequest(HttpRequest $request)
    {
        foreach ($request->getHeaders() as $name => $value) {
            if ($name === $this->credentialsHeader) {
                if (!preg_match(self::HEADER_REGEX, $value, $matches)) {
                    throw new WrongSchemeHeaderException(
                        $this->credentialsHeader,
                        sprintf('Value does not match "%s"', self::HEADER_REGEX)
                    );
                }

                try {
                    $token = $this->getScheme($matches[1])->parseHeaderValue($matches[2]);
                } catch (WrongHeaderValueException $e) {
                    throw new WrongSchemeHeaderException($this->credentialsHeader, 'Wrong scheme header value', $matches[1], $e);
                }

                return new AuthenticationData($matches[1], $token);
            }
        }

        throw new HeaderNotFoundException($this->credentialsHeader);
    }