private static boolean matchesRequiredCredentials(RequiredPeerCredential requiredCredential, String cn, List<String> sans) {
        return switch (requiredCredential.field()) {
            case CN -> cn != null && requiredCredential.pattern().matches(cn);
            case SAN_DNS, SAN_URI -> sans.stream().anyMatch(san -> requiredCredential.pattern().matches(san));
        };
    }
Uses rules from {@link AuthorizedPeers} to evaluate X509 certificates

@author bjorncs
security-utils/src/main/java/com/yahoo/security/tls/PeerAuthorizer.java