-
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.
Merge pull request #74 from KOA-TF/feat/auth
refactor : API request 형식 수정, HTTP 메서드 수정, 로그아웃 로직 수정
- Loading branch information
Showing
37 changed files
with
262 additions
and
137 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
14 changes: 14 additions & 0 deletions
14
core-module/src/main/java/com/koa/coremodule/auth/application/dto/LoginRequest.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,14 @@ | ||
package com.koa.coremodule.auth.application.dto; | ||
|
||
import lombok.AccessLevel; | ||
import lombok.AllArgsConstructor; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
|
||
@Getter | ||
@AllArgsConstructor | ||
@NoArgsConstructor(access = AccessLevel.PROTECTED) | ||
public class LoginRequest { | ||
private String email; | ||
private String password; | ||
} |
21 changes: 21 additions & 0 deletions
21
...c/main/java/com/koa/coremodule/auth/application/handler/AlarmTokenDeleteEventHandler.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,21 @@ | ||
package com.koa.coremodule.auth.application.handler; | ||
|
||
import com.koa.coremodule.auth.application.handler.event.AlarmTokenDeleteEvent; | ||
import com.koa.coremodule.fcm.domain.service.AlarmDeleteService; | ||
import lombok.RequiredArgsConstructor; | ||
import org.springframework.context.event.EventListener; | ||
import org.springframework.stereotype.Component; | ||
import org.springframework.transaction.annotation.Transactional; | ||
|
||
@Component | ||
@RequiredArgsConstructor | ||
@Transactional | ||
public class AlarmTokenDeleteEventHandler { | ||
|
||
private final AlarmDeleteService alarmDeleteService; | ||
|
||
@EventListener | ||
public void handle(AlarmTokenDeleteEvent event){ | ||
alarmDeleteService.deleteFcmToken(event.getMemberId()); | ||
} | ||
} |
10 changes: 10 additions & 0 deletions
10
...rc/main/java/com/koa/coremodule/auth/application/handler/event/AlarmTokenDeleteEvent.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,10 @@ | ||
package com.koa.coremodule.auth.application.handler.event; | ||
|
||
import lombok.AllArgsConstructor; | ||
import lombok.Getter; | ||
|
||
@Getter | ||
@AllArgsConstructor | ||
public class AlarmTokenDeleteEvent { | ||
private final Long memberId; | ||
} |
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
10 changes: 10 additions & 0 deletions
10
core-module/src/main/java/com/koa/coremodule/auth/application/service/LogoutUseCase.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 |
---|---|---|
@@ -1,23 +1,33 @@ | ||
package com.koa.coremodule.auth.application.service; | ||
|
||
import com.koa.commonmodule.annotation.ApplicationService; | ||
import com.koa.coremodule.auth.application.handler.event.AlarmTokenDeleteEvent; | ||
import com.koa.coremodule.auth.application.utils.TokenExtractUtils; | ||
import com.koa.coremodule.auth.domain.entity.Token; | ||
import com.koa.coremodule.auth.domain.entity.TokenType; | ||
import com.koa.coremodule.auth.domain.service.TokenDeleteService; | ||
import com.koa.coremodule.auth.domain.service.TokenQueryService; | ||
import com.koa.coremodule.member.domain.entity.Member; | ||
import com.koa.coremodule.member.domain.utils.MemberUtils; | ||
import lombok.RequiredArgsConstructor; | ||
import org.springframework.context.ApplicationEventPublisher; | ||
import org.springframework.transaction.annotation.Transactional; | ||
|
||
@ApplicationService | ||
@RequiredArgsConstructor | ||
@Transactional | ||
public class LogoutUseCase { | ||
private final TokenDeleteService tokenDeleteService; | ||
private final TokenQueryService tokenQueryService; | ||
private final ApplicationEventPublisher applicationEventPublisher; | ||
private final MemberUtils memberUtils; | ||
|
||
public void logoutAccessUser(String refreshTokenHeader) { | ||
final Member member = memberUtils.getAccessMember(); | ||
final String refreshToken = TokenExtractUtils.extractToken(refreshTokenHeader); | ||
final Token refreshTokenEntity = tokenQueryService.findTokenByTokenValue(refreshToken, TokenType.REFRESH_TOKEN); | ||
tokenDeleteService.deleteToken(refreshTokenEntity); | ||
applicationEventPublisher.publishEvent(new AlarmTokenDeleteEvent(member.getId())); | ||
} | ||
|
||
} |
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
14 changes: 14 additions & 0 deletions
14
...ule/src/main/java/com/koa/coremodule/email/application/dto/request/VerifyCodeRequest.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,14 @@ | ||
package com.koa.coremodule.email.application.dto.request; | ||
|
||
import lombok.AccessLevel; | ||
import lombok.AllArgsConstructor; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
|
||
@Getter | ||
@AllArgsConstructor | ||
@NoArgsConstructor(access = AccessLevel.PROTECTED) | ||
public class VerifyCodeRequest { | ||
private String email; | ||
private String code; | ||
} |
16 changes: 16 additions & 0 deletions
16
...le/src/main/java/com/koa/coremodule/email/application/dto/request/VerifyEmailRequest.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,16 @@ | ||
package com.koa.coremodule.email.application.dto.request; | ||
|
||
import lombok.AccessLevel; | ||
import lombok.AllArgsConstructor; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
|
||
@Getter | ||
@NoArgsConstructor(access = AccessLevel.PROTECTED) | ||
public class VerifyEmailRequest { | ||
private String email; | ||
|
||
public VerifyEmailRequest(String email) { | ||
this.email = email; | ||
} | ||
} |
2 changes: 1 addition & 1 deletion
2
...tion/dto/response/VerifyCodeResponse.java → ...tion/dto/response/VerifyCodeResponse.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
Oops, something went wrong.