AuthenticationChallenge.parse constructor

AuthenticationChallenge.parse(
  1. String challenge
)

Parses a single WWW-Authenticate challenge value.

Throws a FormatException if the challenge is invalid.

Implementation

factory AuthenticationChallenge.parse(String challenge) =>
    wrapFormatException('authentication challenge', challenge, () {
      final scanner = StringScanner(challenge);
      scanner.scan(whitespace);
      final scheme = _scanScheme(scanner);

      final params = <String, String>{};
      parseList(scanner, () => _scanAuthParam(scanner, params));

      scanner.expectDone();
      return AuthenticationChallenge(scheme, params);
    });