Skip to content

Commit

Permalink
feat: send signup admin msg
Browse files Browse the repository at this point in the history
  • Loading branch information
Kang1221 committed Oct 15, 2024
1 parent 628e9d8 commit 53de2fb
Showing 1 changed file with 2 additions and 32 deletions.
34 changes: 2 additions & 32 deletions src/main/java/co/orange/ddanzi/service/auth/OAuthService.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package co.orange.ddanzi.service.auth;

import co.orange.ddanzi.domain.user.User;
import co.orange.ddanzi.domain.user.enums.FcmCase;
import co.orange.ddanzi.domain.user.enums.LoginType;
import co.orange.ddanzi.domain.user.enums.UserStatus;
import co.orange.ddanzi.dto.auth.SigninRequestDto;
Expand Down Expand Up @@ -69,7 +68,7 @@ public User kakaoSignIn(SigninRequestDto requestDto) throws JsonProcessingExcept
User user = userRepository.findByEmail(email).orElse(null);

if (user == null){
fcmService.sendMessageToAdmin(FcmCase.C1);
fcmService.sendMessageToAdmins("⚠️관리자 알림: 카카오 회원가입", "새로운 유저가 등록되었습니다. 총 유저 수: " + userRepository.count());
return kakaoSignUp(email);
}
return user;
Expand Down Expand Up @@ -132,6 +131,7 @@ public User appleSignin(SigninRequestDto requestDto) throws JsonProcessingExcept
User user = userRepository.findByEmail(email).orElse(null);
if (user == null) {
log.info("애플 회원가입 시작");
fcmService.sendMessageToAdmins("⚠️관리자 알림: 애플 회원가입", "새로운 유저가 등록되었습니다. 총 유저 수: " + userRepository.count());
return appleSignup(email);
}
return user;
Expand Down Expand Up @@ -178,21 +178,6 @@ public String getAppleEmail(String authorizationCode) {
return payload.getEmail();
}

// private String generateClientSecret() {
//
// LocalDateTime expiration = LocalDateTime.now().plusMinutes(5);
//
// return Jwts.builder()
// .setHeaderParam(JwsHeader.KEY_ID, appleProperties.getKeyId())
// .setIssuer(appleProperties.getTeamId())
// .setAudience(appleProperties.getAudience())
// .setSubject(appleProperties.getClientId())
// .setExpiration(Date.from(expiration.atZone(ZoneId.systemDefault()).toInstant()))
// .setIssuedAt(new Date())
// .signWith(getPrivateKey(), SignatureAlgorithm.ES256)
// .compact();
// }

public String createClientSecret() {

JWSHeader header = new JWSHeader.Builder(JWSAlgorithm.ES256).keyID(appleProperties.getKeyId()).build();
Expand Down Expand Up @@ -239,21 +224,6 @@ public byte[] readPrivateKey() {
return content;
}

// private PrivateKey getPrivateKey() {
// Security.addProvider(new org.bouncycastle.jce.provider.BouncyCastleProvider());
// JcaPEMKeyConverter converter = new JcaPEMKeyConverter().setProvider("BC");
//
// try {
// byte[] privateKeyBytes = Base64.getDecoder().decode(appleProperties.getPrivateKey());
//
// PrivateKeyInfo privateKeyInfo = PrivateKeyInfo.getInstance(privateKeyBytes);
// return converter.getPrivateKey(privateKeyInfo);
// } catch (Exception e) {
// throw new RuntimeException("Error converting private key from String", e);
// }
// }


// TokenDecoder 메소드를 GetMemberInfoService 내부에 통합
private <T> T decodePayload(String token, Class<T> targetClass) {
String[] tokenParts = token.split("\\.");
Expand Down

0 comments on commit 53de2fb

Please sign in to comment.