private static List<Client> parseClients(CloudTokenDataPlaneFilterConfig cfg) {
        Set<String> ids = new HashSet<>();
        List<Client> clients = new ArrayList<>(cfg.clients().size());
        for (var c : cfg.clients()) {
            if (ids.contains(c.id()))
                throw new IllegalArgumentException("Clients definition has duplicate id '%s'".formatted(c.id()));
            if (c.tokens().isEmpty())
                throw new IllegalArgumentException("Client '%s' has no tokens configured".formatted(c.id()));
            ids.add(c.id());
            var tokens = new HashMap<TokenCheckHash, TokenVersion>();
            for (var token : c.tokens()) {
                for (int version = 0; version < token.checkAccessHashes().size(); version++) {
                    var tokenVersion = TokenVersion.of(
                            token.id(), token.fingerprints().get(version), token.checkAccessHashes().get(version),
                            token.expirations().get(version));
                    tokens.put(tokenVersion.accessHash(), tokenVersion);
                }
            }
            clients.add(new Client(c.id(), Permission.setOf(c.permissions()), tokens));
        }
        log.fine(() -> "Configured clients with ids %s".formatted(ids));
        return List.copyOf(clients);
    }
Token data plane filter for Cloud

@author bjorncs
jdisc-security-filters/src/main/java/com/yahoo/jdisc/http/filter/security/cloud/CloudTokenDataPlaneFilter.java