diff options
Diffstat (limited to 'src/main/java/com/github/scribejava/apis')
-rw-r--r-- | src/main/java/com/github/scribejava/apis/AppleClientSecretGenerator.java | 18 | ||||
-rw-r--r-- | src/main/java/com/github/scribejava/apis/AppleSignInApi.java | 1 |
2 files changed, 10 insertions, 9 deletions
diff --git a/src/main/java/com/github/scribejava/apis/AppleClientSecretGenerator.java b/src/main/java/com/github/scribejava/apis/AppleClientSecretGenerator.java index f8e10d97c..f3406182b 100644 --- a/src/main/java/com/github/scribejava/apis/AppleClientSecretGenerator.java +++ b/src/main/java/com/github/scribejava/apis/AppleClientSecretGenerator.java @@ -19,18 +19,20 @@ package com.github.scribejava.apis; import io.jsonwebtoken.Jwts; import io.jsonwebtoken.SignatureAlgorithm; -import org.apache.commons.io.IOUtils; import java.io.IOException; -import java.io.InputStream; import java.nio.charset.StandardCharsets; +import java.nio.file.Files; +import java.nio.file.Path; import java.security.Key; import java.security.KeyFactory; import java.security.NoSuchAlgorithmException; import java.security.spec.EncodedKeySpec; import java.security.spec.InvalidKeySpecException; import java.security.spec.PKCS8EncodedKeySpec; -import java.time.*; +import java.time.Instant; +import java.time.ZoneId; +import java.time.ZonedDateTime; import java.util.Base64; import java.util.Date; @@ -41,16 +43,16 @@ public class AppleClientSecretGenerator { private final Key signingKey; - private final String pemData; + private final byte[] pemData; - public AppleClientSecretGenerator(final String subject, final String teamId, final String keyId, final InputStream keyData) + public AppleClientSecretGenerator(final String subject, final String teamId, final String keyId, final Path keyFile) throws IOException, NoSuchAlgorithmException, InvalidKeySpecException { this.subject = subject; this.keyId = keyId; this.teamId = teamId; - this.pemData = IOUtils.toString(keyData, StandardCharsets.UTF_8); - String p8encodedData = getPemData() + this.pemData = Files.readAllBytes(keyFile); + String p8encodedData = new String(getPemData(), StandardCharsets.UTF_8) .replace( "-----BEGIN PRIVATE KEY-----\n", "") .replace("\n", "") @@ -85,7 +87,7 @@ public class AppleClientSecretGenerator { return subject; } - public String getPemData() { + public byte[] getPemData() { return pemData; } } diff --git a/src/main/java/com/github/scribejava/apis/AppleSignInApi.java b/src/main/java/com/github/scribejava/apis/AppleSignInApi.java index 14b7f0e6d..7d960d357 100644 --- a/src/main/java/com/github/scribejava/apis/AppleSignInApi.java +++ b/src/main/java/com/github/scribejava/apis/AppleSignInApi.java @@ -18,7 +18,6 @@ package com.github.scribejava.apis; import com.github.scribejava.core.builder.api.DefaultApi20; -import com.github.scribejava.core.model.OAuth2AccessToken; import com.github.scribejava.core.oauth2.clientauthentication.ClientAuthentication; import com.nimbusds.jose.JOSEException; import com.nimbusds.jose.JWSAlgorithm; |