From deef9ad990c3f5902b1556edbf93dabf223ac175 Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Mon, 18 May 2020 13:41:35 +0300 Subject: Fix startup exception --- src/main/java/com/juick/config/SignInWithAppleConfig.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src/main/java/com/juick/config/SignInWithAppleConfig.java') diff --git a/src/main/java/com/juick/config/SignInWithAppleConfig.java b/src/main/java/com/juick/config/SignInWithAppleConfig.java index 0b41cb7e..bbd58aed 100644 --- a/src/main/java/com/juick/config/SignInWithAppleConfig.java +++ b/src/main/java/com/juick/config/SignInWithAppleConfig.java @@ -18,6 +18,7 @@ package com.juick.config; import com.github.scribejava.apis.AppleClientSecretGenerator; +import org.apache.commons.io.IOUtils; import org.springframework.beans.factory.annotation.Value; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; @@ -35,11 +36,12 @@ public class SignInWithAppleConfig { private String teamId; @Value("${apple_key_id:keyid}") private String keyId; - @Value("${apple_key_path:classpath:testkey.p8}") + @Value("${apple_key_path:classpath:/testkey.p8}") private Resource keyPath; @Bean public AppleClientSecretGenerator clientSecretGenerator() throws IOException, InvalidKeySpecException, NoSuchAlgorithmException { - return new AppleClientSecretGenerator(appId, teamId, keyId, keyPath.getFile().toPath()); + byte[] pemData = IOUtils.toByteArray(keyPath.getInputStream()); + return new AppleClientSecretGenerator(appId, teamId, keyId, pemData); } } -- cgit v1.2.3