Skip to content

Commit

Permalink
YEL-148 [merge] 개발서버 배포
Browse files Browse the repository at this point in the history
YEL-148 [merge] 개발서버 배포
  • Loading branch information
hyeonjeongs authored Aug 29, 2023
2 parents 22e67ec + bf2a6ff commit 0f7d5a2
Show file tree
Hide file tree
Showing 7 changed files with 25 additions and 148 deletions.
21 changes: 19 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,14 @@ name: ✨ YELL:O Build

on:
pull_request:
branches: [ "main", "develop" ]
branches:
- main
- staging
- develop

permissions:
contents: read
checks: write
pull-requests: write

jobs:
build:
Expand Down Expand Up @@ -40,6 +44,19 @@ jobs:
- name: 🐘 Gradle로 빌드 실행
run: ./gradlew build

- name: 💬 테스트 결과를 코멘트로 등록합니다.
uses: EnricoMi/publish-unit-test-result-action@v2
if: always()
with:
files: '**/build/test-results/test/TEST-*.xml'

- name: 테스트 실패 시, 실패한 코드 라인에 Check 코멘트를 등록합니다
uses: mikepenz/action-junit-report@v3
if: always()
with:
report_paths: '**/build/test-results/test/TEST-*.xml'
token: ${{ github.token }}

- name: 💡 배포 상태를 Slack을 통해 전송합니다.
uses: rtCamp/action-slack-notify@v2
env:
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/deploy-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ name: 🚀 YELL:O Deploy for staging server

on:
push:
branches: [ "staging" ]
branches:
- staging

permissions:
contents: read
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ name: 🚀 YELL:O Deploy

on:
push:
branches: [ "main" ]
branches:
- main

permissions:
contents: read
Expand Down
76 changes: 0 additions & 76 deletions .github/workflows/test.yml

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,20 +1,10 @@
package com.yello.server.global.common.factory;

import static java.util.Base64.getDecoder;
import static java.util.Base64.getMimeDecoder;

import com.yello.server.domain.purchase.dto.response.AppleJwsTransactionResponse;
import io.jsonwebtoken.Claims;
import io.jsonwebtoken.Jwts;
import io.jsonwebtoken.SignatureAlgorithm;
import java.security.KeyFactory;
import java.security.NoSuchAlgorithmException;
import java.security.PrivateKey;
import java.security.Signature;
import java.security.interfaces.RSAPublicKey;
import java.security.spec.InvalidKeySpecException;
import java.security.spec.PKCS8EncodedKeySpec;
import java.security.spec.X509EncodedKeySpec;
import java.util.Date;
import lombok.SneakyThrows;
import org.apache.commons.codec.binary.Base64;
Expand All @@ -40,32 +30,6 @@ public class TokenFactoryImpl implements TokenFactory {
private String sig;


private static PrivateKey getPrivateKeyFromPem(String privateKeyBytes)
throws NoSuchAlgorithmException, InvalidKeySpecException {
byte[] decode = getMimeDecoder().decode(privateKeyBytes);
PKCS8EncodedKeySpec keySpec = new PKCS8EncodedKeySpec(decode);

KeyFactory keyFactory = KeyFactory.getInstance("RSA");

System.out.println(keyFactory.generatePrivate(keySpec) + " sdfsdfsdfs");
return keyFactory.generatePrivate(keySpec);
}

private static RSAPublicKey getPublicKeyFromPem(String publicKeyBytes)
throws NoSuchAlgorithmException, InvalidKeySpecException {

System.out.println(publicKeyBytes + " dddddddd");
byte[] encoded = getMimeDecoder().decode(publicKeyBytes);
X509EncodedKeySpec keySpec = new X509EncodedKeySpec(encoded);
System.out.println(encoded + " ddsdfsdfss");

KeyFactory keyFactory = KeyFactory.getInstance("RSA");
RSAPublicKey pubKey =
(RSAPublicKey) keyFactory.generatePublic(keySpec);
System.out.println(pubKey + " sdfsdfsddddfs");
return pubKey;
}

@SneakyThrows
@Override
public String generateAppleToken() {
Expand All @@ -87,36 +51,6 @@ public String generateAppleToken() {
@SneakyThrows
@Override
public AppleJwsTransactionResponse decodeTransactionToken(String signedTransactionInfo) {
String publicKeyPem =
"MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEnWMSCXOIO30RT6uO/gftB3vMIk7J\n"
+ "B46aGm4OglC1fAJFxrpFVHkKMeH+onROoJMtmel4POfh6VADeKQdtddQIA==";
String privateKeyPem =
"MIGTAgEAMBMGByqGSM49AgEGCCqGSM49AwEHBHkwdwIBAQQgFb1FLrKi9PvnQ9/x\n"
+ "rSHp2WtTq8kJ663R9ctCm9JKO5OgCgYIKoZIzj0DAQehRANCAATolS9U3fxQyN2N\n"
+ "x/1DFHRTQucP/4ndvBwLxrS9RoxT3gFoChT31r98O8dgVj3VlUPU32WDlpdowglA\n"
+ "XZKAWIVY";
//byte[] publicKeyBytes = getDecoder().decode(publicKeyPem);
//byte[] privateKeyBytes = getDecoder().decode(privateKeyPem);

RSAPublicKey publicKey = getPublicKeyFromPem(publicKeyPem);
PrivateKey privateKey = getPrivateKeyFromPem(privateKeyPem);

Signature signature = Signature.getInstance("SHA256withRSA");
signature.initVerify(publicKey);
signature.update(signedTransactionInfo.getBytes());

byte[] signatureBytes =
getDecoder().decode(signedTransactionInfo.split("\\.")[2]);
boolean isValid = signature.verify(signatureBytes);

if (isValid) {
Claims claims = Jwts.parserBuilder()
.setSigningKey(publicKey)
.build()
.parseClaimsJws(signedTransactionInfo)
.getBody();
return AppleJwsTransactionResponse.of(claims);
}

return null;
}
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/static/docs/check-vote-available.html
Original file line number Diff line number Diff line change
Expand Up @@ -465,7 +465,7 @@ <h3 id="_응답">응답</h3>
"data" : {
"isPossible" : false,
"point" : 200,
"createdAt" : "2023-08-27 23:08:50"
"createdAt" : "2023-08-27 23:11:59"
}
}</code></pre>
</div>
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/static/docs/google.html
Original file line number Diff line number Diff line change
Expand Up @@ -478,7 +478,7 @@ <h3 id="_응답">응답</h3>
"message" : "구글 구독 결제 검증 및 반영에 성공하였습니다.",
"data" : {
"productId" : "productId",
"expiredAt" : "2023-08-27T23:08:49.542865"
"expiredAt" : "2023-08-27T23:11:58.392011"
}
}</code></pre>
</div>
Expand Down

0 comments on commit 0f7d5a2

Please sign in to comment.