class Audience {

    static Audience fromJson(final JsonValue audValue) {
        final JsonArray principles;

        if (audValue.isArray()) {
            principles = audValue.asArray();
        } else if (audValue.isString()) {
            principles = JsonArray.of(audValue);
        } else {
            throw JwtAudienceInvalidException
                    .newBuilder(audValue)
                    .build();
        }

        final List<String> stringPrinciples = principles.stream()
                .map(JsonValue::asString)
                .distinct()
                .collect(Collectors.toList());

        return new Audience(stringPrinciples);
    }

    private  Audience(final List<String> principles);

}