From ef2c53357a9e7b3b33644cfaa2e3f7c74dd3442d Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Fri, 13 May 2022 00:37:35 +0300 Subject: Refactor AppleClientSecretGenerator --- src/test/java/com/juick/server/tests/ServerTests.java | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) (limited to 'src/test/java/com') diff --git a/src/test/java/com/juick/server/tests/ServerTests.java b/src/test/java/com/juick/server/tests/ServerTests.java index 3edd4596..36483ce8 100644 --- a/src/test/java/com/juick/server/tests/ServerTests.java +++ b/src/test/java/com/juick/server/tests/ServerTests.java @@ -221,8 +221,6 @@ import org.springframework.web.client.RestTemplate; import org.springframework.web.util.UriComponents; import org.springframework.web.util.UriComponentsBuilder; import org.tomitribe.auth.signatures.Base64; -import org.tomitribe.churchkey.Key; -import org.tomitribe.churchkey.Keys; import org.w3c.dom.Document; import org.w3c.dom.Element; import org.w3c.dom.NamedNodeMap; @@ -2481,12 +2479,9 @@ public class ServerTests { public void testAppleClientSecret() throws NoSuchAlgorithmException, IOException, InvalidKeySpecException, NoSuchProviderException { String secret = new String(clientSecretGenerator.getClientSecret().getBytes(), StandardCharsets.UTF_8); - final Key key = Keys.decode(clientSecretGenerator.getPemData()); - - // Get the public key - final Key publicKey = key.getPublicKey(); + final java.security.Key publicKey = clientSecretGenerator.getPublicKey(); - Jws jwt = Jwts.parserBuilder().setSigningKey(publicKey.getKey()).build().parseClaimsJws(secret); + Jws jwt = Jwts.parserBuilder().setSigningKey(publicKey).build().parseClaimsJws(secret); assertThat(jwt.getHeader().get("kid"), is("keyid")); assertThat(jwt.getHeader().get("alg"), is("ES256")); Claims claims = jwt.getBody(); -- cgit v1.2.3