diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 5fb50ab94..1b992243b 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -31,15 +31,9 @@ jobs: - name: Create apple login key file env: API_KEY: ${{ secrets.APPSTORE_API_KEY_ID }} - run: | - mkdir -p src/main/resources/static - echo "${{ secrets.APPLE_AUTH_KEY }}" > src/main/resources/static/AuthKey_$API_KEY.p8 - - - name: Verify file generation run: | mkdir -p src/main/resources/static/apple - echo "${{ secrets.APPLE_AUTH_KEY }}" > src/main/resources/static/apple/AuthKey_${{ secrets.APPSTORE_API_KEY_ID }}.p8 - ls -la src/main/resources/static/apple + echo "${{ secrets.APPLE_AUTH_KEY }}" > src/main/resources/static/apple/AuthKey_$API_KEY.p8 - name: Grant execute permission for gradlew run: chmod +x gradlew diff --git a/src/main/java/org/websoso/WSSServer/oauth2/service/AppleService.java b/src/main/java/org/websoso/WSSServer/oauth2/service/AppleService.java index 5a9b61e94..1b85323cc 100644 --- a/src/main/java/org/websoso/WSSServer/oauth2/service/AppleService.java +++ b/src/main/java/org/websoso/WSSServer/oauth2/service/AppleService.java @@ -23,8 +23,8 @@ import io.jsonwebtoken.JwtException; import io.jsonwebtoken.Jwts; import io.jsonwebtoken.UnsupportedJwtException; +import java.io.FileReader; import java.io.IOException; -import java.io.InputStreamReader; import java.math.BigInteger; import java.security.KeyFactory; import java.security.NoSuchAlgorithmException; @@ -220,7 +220,7 @@ private byte[] readPrivateKey(String keyPath) { Resource resource = new ClassPathResource(keyPath); System.out.println("Resource exists: " + resource.exists()); System.out.println("Resource file path: " + resource.getFilename()); - try (PemReader pemReader = new PemReader(new InputStreamReader(resource.getInputStream()))) { + try (PemReader pemReader = new PemReader(new FileReader(resource.getFile()))) { PemObject pemObject = pemReader.readPemObject(); return pemObject.getContent(); } catch (IOException e) {