authenticate method

  1. @override
Future<Principal?> authenticate(
  1. HubRequest request
)
override

Authenticates request. See the class contract for the return/throw semantics.

Implementation

@override
Future<Principal?> authenticate(HubRequest request) async {
  UnauthorizedException? pending;
  for (final authenticator in authenticators) {
    try {
      final principal = await authenticator.authenticate(request);
      if (principal != null) return principal;
    } on UnauthorizedException catch (e) {
      pending = e;
    }
  }
  if (pending != null) throw pending;
  return null;
}