@Test void testParse_MissingKid_Fails() throws URISyntaxException, IOException { Path path = Paths.get(toUri("testdata/jwtbundle/jwks_missing_kid.json")); byte[] bundleBytes = Files.readAllBytes(path); TrustDomain trustDomain = TrustDomain.of("domain.test"); try { JwtBundle.parse(trustDomain, bundleBytes); fail("should have thrown exception"); } catch (JwtBundleException e) { assertEquals("Error adding authority of JWKS: keyID cannot be empty", e.getMessage()); } }
public static JwtBundle parse( @NonNull final TrustDomain trustDomain, @NonNull final byte[] bundleBytes) throws JwtBundleException { try { val jwkSet = JWKSet.parse(new String(bundleBytes)); return toJwtBundle(trustDomain, jwkSet); } catch (ParseException | JOSEException | KeyException e) { throw new JwtBundleException("Could not parse bundle from bytes", e); } }
JwtBundle implements BundleSource<JwtBundle> { public static JwtBundle parse( @NonNull final TrustDomain trustDomain, @NonNull final byte[] bundleBytes) throws JwtBundleException { try { val jwkSet = JWKSet.parse(new String(bundleBytes)); return toJwtBundle(trustDomain, jwkSet); } catch (ParseException | JOSEException | KeyException e) { throw new JwtBundleException("Could not parse bundle from bytes", e); } } }
JwtBundle implements BundleSource<JwtBundle> { public static JwtBundle parse( @NonNull final TrustDomain trustDomain, @NonNull final byte[] bundleBytes) throws JwtBundleException { try { val jwkSet = JWKSet.parse(new String(bundleBytes)); return toJwtBundle(trustDomain, jwkSet); } catch (ParseException | JOSEException | KeyException e) { throw new JwtBundleException("Could not parse bundle from bytes", e); } } JwtBundle(@NonNull final TrustDomain trustDomain);  JwtBundle(@NonNull final TrustDomain trustDomain, @NonNull final Map<String, PublicKey> jwtAuthorities); }
JwtBundle implements BundleSource<JwtBundle> { public static JwtBundle parse( @NonNull final TrustDomain trustDomain, @NonNull final byte[] bundleBytes) throws JwtBundleException { try { val jwkSet = JWKSet.parse(new String(bundleBytes)); return toJwtBundle(trustDomain, jwkSet); } catch (ParseException | JOSEException | KeyException e) { throw new JwtBundleException("Could not parse bundle from bytes", e); } } JwtBundle(@NonNull final TrustDomain trustDomain);  JwtBundle(@NonNull final TrustDomain trustDomain, @NonNull final Map<String, PublicKey> jwtAuthorities); static JwtBundle load(@NonNull final TrustDomain trustDomain, @NonNull final Path bundlePath); static JwtBundle parse(
            @NonNull final TrustDomain trustDomain,
            @NonNull final byte[] bundleBytes); @Override JwtBundle getBundleForTrustDomain(final TrustDomain trustDomain); Map<String, PublicKey> getJwtAuthorities(); PublicKey findJwtAuthority(final String keyId); boolean hasJwtAuthority(final String keyId); void putJwtAuthority(@NonNull final String keyId, @NonNull final PublicKey jwtAuthority); void removeJwtAuthority(final String keyId); }
JwtBundle implements BundleSource<JwtBundle> { public static JwtBundle parse( @NonNull final TrustDomain trustDomain, @NonNull final byte[] bundleBytes) throws JwtBundleException { try { val jwkSet = JWKSet.parse(new String(bundleBytes)); return toJwtBundle(trustDomain, jwkSet); } catch (ParseException | JOSEException | KeyException e) { throw new JwtBundleException("Could not parse bundle from bytes", e); } } JwtBundle(@NonNull final TrustDomain trustDomain);  JwtBundle(@NonNull final TrustDomain trustDomain, @NonNull final Map<String, PublicKey> jwtAuthorities); static JwtBundle load(@NonNull final TrustDomain trustDomain, @NonNull final Path bundlePath); static JwtBundle parse(
            @NonNull final TrustDomain trustDomain,
            @NonNull final byte[] bundleBytes); @Override JwtBundle getBundleForTrustDomain(final TrustDomain trustDomain); Map<String, PublicKey> getJwtAuthorities(); PublicKey findJwtAuthority(final String keyId); boolean hasJwtAuthority(final String keyId); void putJwtAuthority(@NonNull final String keyId, @NonNull final PublicKey jwtAuthority); void removeJwtAuthority(final String keyId);  }