-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat : 애플 로그인 연동 해제 구현 * feat : 회원 탈퇴 구현 - 로그인 & 회원가입 관련 #142 * feat : 회원 탈퇴 구현 - 유저, 답변 관련 로직 수정 #142 * feat : validation 추가 #142
- Loading branch information
1 parent
76789ce
commit a86a897
Showing
43 changed files
with
483 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
59 changes: 59 additions & 0 deletions
59
Api/src/main/java/tify/server/api/auth/service/ResignUseCase.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
package tify.server.api.auth.service; | ||
|
||
|
||
import java.io.IOException; | ||
import java.security.NoSuchAlgorithmException; | ||
import java.security.spec.InvalidKeySpecException; | ||
import lombok.RequiredArgsConstructor; | ||
import org.springframework.transaction.annotation.Transactional; | ||
import tify.server.core.annotation.UseCase; | ||
import tify.server.core.jwt.JwtTokenProvider; | ||
import tify.server.core.properties.OauthProperties; | ||
import tify.server.domain.domains.user.adaptor.UserAdaptor; | ||
import tify.server.domain.domains.user.adaptor.UserResignAdaptor; | ||
import tify.server.domain.domains.user.domain.User; | ||
import tify.server.domain.domains.user.domain.UserResign; | ||
import tify.server.domain.domains.user.validator.UserValidator; | ||
import tify.server.infrastructure.outer.api.oauth.client.AppleRevokeClient; | ||
import tify.server.infrastructure.outer.api.oauth.dto.AppleRevokeRequest; | ||
|
||
@UseCase | ||
@RequiredArgsConstructor | ||
public class ResignUseCase { | ||
|
||
private final UserAdaptor userAdaptor; | ||
private final UserValidator userValidator; | ||
private final UserResignAdaptor userResignAdaptor; | ||
private final OauthProperties oauthProperties; | ||
private final JwtTokenProvider jwtTokenProvider; | ||
private final AppleRevokeClient appleRevokeClient; | ||
|
||
@Transactional | ||
public void execute(Long userId) { | ||
User user = userAdaptor.query(userId); | ||
userValidator.isNewResign(user.getOauthInfo()); | ||
userResignAdaptor.save( | ||
UserResign.builder().userId(userId).oauthInfo(user.getOauthInfo()).build()); | ||
} | ||
|
||
@Transactional(readOnly = true) | ||
public void revokeAppleToken(Long userId) | ||
throws IOException, NoSuchAlgorithmException, InvalidKeySpecException { | ||
User user = userAdaptor.query(userId); | ||
String refreshToken = user.getAppleRefreshToken(); | ||
AppleRevokeRequest request = | ||
AppleRevokeRequest.builder() | ||
.client_id(oauthProperties.getAppleClientUrl()) | ||
.client_secret(jwtTokenProvider.buildAppleClientSecret()) | ||
.token(refreshToken) | ||
.type("refresh_token") | ||
.build(); | ||
appleRevokeClient.appleRevoke(request); | ||
} | ||
|
||
@Transactional | ||
public void delete(Long userId) { | ||
UserResign userResign = userResignAdaptor.queryByUserId(userId); | ||
userResignAdaptor.delete(userResign); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.