AuthenticationRule.fromJson constructor

AuthenticationRule.fromJson(
  1. Object? j
)

Implementation

factory AuthenticationRule.fromJson(Object? j) {
  final json = j as Map<String, Object?>;
  return AuthenticationRule(
    selector: switch (json['selector']) {
      null => '',
      Object $1 => decodeString($1),
    },
    oauth: switch (json['oauth']) {
      null => null,
      Object $1 => OauthRequirements.fromJson($1),
    },
    allowWithoutCredential: switch (json['allowWithoutCredential']) {
      null => false,
      Object $1 => decodeBool($1),
    },
    requirements: switch (json['requirements']) {
      null => [],
      List<Object?> $1 => [for (final i in $1) AuthRequirement.fromJson(i)],
      _ => throw const FormatException('"requirements" is not a list'),
    },
  );
}