@Test void verifySpiffeId_givenAnEmptySupplier_throwsCertificateException() { try { X509SvidValidator.verifySpiffeId(leaf.getCertificate(), Collections::emptySet); fail("Should have thrown CertificateException"); } catch (CertificateException e) { assertEquals("The supplier of accepted SPIFFE IDs supplied an empty set", e.getMessage()); } }
public static void verifySpiffeId(@NonNull final X509Certificate x509Certificate, @NonNull final Supplier<Set<SpiffeId>> acceptedSpiffeIdsSupplier) throws CertificateException { val spiffeIdSet = acceptedSpiffeIdsSupplier.get(); if (spiffeIdSet.isEmpty()) { String error = "The supplier of accepted SPIFFE IDs supplied an empty set"; log.warning(error); throw new CertificateException(error); } val spiffeId = CertificateUtils.getSpiffeId(x509Certificate); if (!spiffeIdSet.contains(spiffeId)) { val error = String.format("SPIFFE ID %s in X.509 certificate is not accepted", spiffeId); log.warning(String.format("Client SPIFFE ID validation failed: %s", error)); throw new CertificateException(String.format(error, spiffeId)); } }
X509SvidValidator { public static void verifySpiffeId(@NonNull final X509Certificate x509Certificate, @NonNull final Supplier<Set<SpiffeId>> acceptedSpiffeIdsSupplier) throws CertificateException { val spiffeIdSet = acceptedSpiffeIdsSupplier.get(); if (spiffeIdSet.isEmpty()) { String error = "The supplier of accepted SPIFFE IDs supplied an empty set"; log.warning(error); throw new CertificateException(error); } val spiffeId = CertificateUtils.getSpiffeId(x509Certificate); if (!spiffeIdSet.contains(spiffeId)) { val error = String.format("SPIFFE ID %s in X.509 certificate is not accepted", spiffeId); log.warning(String.format("Client SPIFFE ID validation failed: %s", error)); throw new CertificateException(String.format(error, spiffeId)); } } }
X509SvidValidator { public static void verifySpiffeId(@NonNull final X509Certificate x509Certificate, @NonNull final Supplier<Set<SpiffeId>> acceptedSpiffeIdsSupplier) throws CertificateException { val spiffeIdSet = acceptedSpiffeIdsSupplier.get(); if (spiffeIdSet.isEmpty()) { String error = "The supplier of accepted SPIFFE IDs supplied an empty set"; log.warning(error); throw new CertificateException(error); } val spiffeId = CertificateUtils.getSpiffeId(x509Certificate); if (!spiffeIdSet.contains(spiffeId)) { val error = String.format("SPIFFE ID %s in X.509 certificate is not accepted", spiffeId); log.warning(String.format("Client SPIFFE ID validation failed: %s", error)); throw new CertificateException(String.format(error, spiffeId)); } } private  X509SvidValidator(); }
X509SvidValidator { public static void verifySpiffeId(@NonNull final X509Certificate x509Certificate, @NonNull final Supplier<Set<SpiffeId>> acceptedSpiffeIdsSupplier) throws CertificateException { val spiffeIdSet = acceptedSpiffeIdsSupplier.get(); if (spiffeIdSet.isEmpty()) { String error = "The supplier of accepted SPIFFE IDs supplied an empty set"; log.warning(error); throw new CertificateException(error); } val spiffeId = CertificateUtils.getSpiffeId(x509Certificate); if (!spiffeIdSet.contains(spiffeId)) { val error = String.format("SPIFFE ID %s in X.509 certificate is not accepted", spiffeId); log.warning(String.format("Client SPIFFE ID validation failed: %s", error)); throw new CertificateException(String.format(error, spiffeId)); } } private  X509SvidValidator(); static void verifyChain(
            @NonNull final List<X509Certificate> chain,
            @NonNull final BundleSource<X509Bundle> x509BundleSource); static void verifySpiffeId(@NonNull final X509Certificate x509Certificate,
                                      @NonNull final Supplier<Set<SpiffeId>> acceptedSpiffeIdsSupplier); }
X509SvidValidator { public static void verifySpiffeId(@NonNull final X509Certificate x509Certificate, @NonNull final Supplier<Set<SpiffeId>> acceptedSpiffeIdsSupplier) throws CertificateException { val spiffeIdSet = acceptedSpiffeIdsSupplier.get(); if (spiffeIdSet.isEmpty()) { String error = "The supplier of accepted SPIFFE IDs supplied an empty set"; log.warning(error); throw new CertificateException(error); } val spiffeId = CertificateUtils.getSpiffeId(x509Certificate); if (!spiffeIdSet.contains(spiffeId)) { val error = String.format("SPIFFE ID %s in X.509 certificate is not accepted", spiffeId); log.warning(String.format("Client SPIFFE ID validation failed: %s", error)); throw new CertificateException(String.format(error, spiffeId)); } } private  X509SvidValidator(); static void verifyChain(
            @NonNull final List<X509Certificate> chain,
            @NonNull final BundleSource<X509Bundle> x509BundleSource); static void verifySpiffeId(@NonNull final X509Certificate x509Certificate,
                                      @NonNull final Supplier<Set<SpiffeId>> acceptedSpiffeIdsSupplier);  }