@Test public void testAuth0JwkDocument() { String keyId = "QzBCMDM1QTI2MjRFMTFDNDBDRTYwRkU4RDdEMzU5RTcwNDRBNjhCNQ"; auth0Keys.forKeyId(keyId).ifPresentOrElse(key -> { assertThat(key.algorithm(), is(JwkRSA.ALG_RS256)); assertThat(key.keyType(), is(Jwk.KEY_TYPE_RSA)); assertThat(key.usage(), is(Optional.of(Jwk.USE_SIGNATURE))); assertThat(key.keyId(), is(keyId)); assertThat(key, instanceOf(JwkPki.class)); assertThat(key, instanceOf(JwkRSA.class)); JwkPki pki = (JwkPki) key; assertThat(pki.certificateChain(), not(Optional.empty())); assertThat(pki.privateKey(), is(Optional.empty())); assertThat(pki.publicKey(), not(Optional.empty())); assertThat(pki.sha1Thumbprint(), not(Optional.empty())); assertThat(Base64.getUrlEncoder().encodeToString(pki.sha1Thumbprint().get()), is("QzBCMDM1QTI2MjRFMTFDNDBDRTYwRkU4RDdEMzU5RTcwNDRBNjhCNQ==")); assertThat(pki.sha256Thumbprint(), is(Optional.empty())); }, () -> fail("Key with id \"" + keyId + "\" should be presenit in auth0-jwk.json file")); }
public Optional<Jwk> forKeyId(String keyId) { return Optional.ofNullable(keyMap.get(keyId)); }
JwkKeys { public Optional<Jwk> forKeyId(String keyId) { return Optional.ofNullable(keyMap.get(keyId)); } }
JwkKeys { public Optional<Jwk> forKeyId(String keyId) { return Optional.ofNullable(keyMap.get(keyId)); } private  JwkKeys(Builder builder); }
JwkKeys { public Optional<Jwk> forKeyId(String keyId) { return Optional.ofNullable(keyMap.get(keyId)); } private  JwkKeys(Builder builder); static Builder builder(); static JwkKeys create(JsonObject json); Optional<Jwk> forKeyId(String keyId); List<Jwk> keys(); }
JwkKeys { public Optional<Jwk> forKeyId(String keyId) { return Optional.ofNullable(keyMap.get(keyId)); } private  JwkKeys(Builder builder); static Builder builder(); static JwkKeys create(JsonObject json); Optional<Jwk> forKeyId(String keyId); List<Jwk> keys();  }