-
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] 로그아웃 구현 및 redis를 통한 임시 유저 저장 구현 (#25)
* [DOCS] PR 템플릿 수정 * [REFACTOR] redis 저장으로 로직 변경 * [MOVE] 이메일 관련 에러 코드 UniversityExceptionType으로 이동 * [DEL] VO 통합으로 인한 삭제 * [DEL] VO 통합으로 인한 삭제 * [DEL] 필요없는 코드 삭제 * [FEAT] redis에 저장할 임시 유저 정의 * [FIX] 요청받을 데이터 수정 * [DEL] Dto명 변경으로 인한 삭제 * [CHORE] 일부 필요없는 코드 삭제 및 데이터 길이 수정 * [REFACTOR] AuthService으로 의존성 정리 * [FEAT] redis관련 로직 구현 * [MOVE] 파일 위치 변경 * [RENAME] 파일 이름 변경 * [RENAME] 파일 이름 변경 * [FEAT] 로그아웃 구현 * [ADD] 로그아웃 Dto 추가 * [REFACTOR] 메일 서비스의 레포지토리 의존성 제거를 통한 개선 * [FEAT] redis, university 레포지토리 추가 * [ADD] secondary index TimeToLive 적용을 위한 코드 추가 * [ADD] RedisException 추가 * [ADD] RedisExceptionType enum 추가 * [FEAT] 임시 유저 저장을 위한 Redis 레포지토리 구현 * [RENAME] 파일 이름 변경 * [ADD] Id로 찾는 메서드 추가 * [FEAT] Id로 찾는 메서드 구현 * [DEL] 필요없는 의존성 제거 * [DEL] 필요없는 코드 제거 * [CHORE] 로그아웃 관련 코드 리뷰 반영 * [CHORE] 함수 이름 변경 * [CHORE] 함수 이름 변경 * [CHORE] 변수 이름 변경 * [CHORE] TTL 시간 변경 * [ADD] 매직리터럴 상수로 추가 * [DOCS] 스웨거 API 문서 작성 * [DOCS] 스웨거 API 문서 수정 * [DOCS] 스웨거 Dto 문서 추가
- Loading branch information
Showing
37 changed files
with
568 additions
and
286 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,23 @@ | ||
# 구현 내용/방법 | ||
## 📝 PR 타입 | ||
- [ ] 기능 추가 | ||
- [ ] 기능 수정 | ||
- [ ] 기능 삭제 | ||
- [ ] 리팩토링 | ||
- [ ] 의존성, 환경 변수, 빌드 관련 코드 업데이트 | ||
|
||
> 간단하게 구현한 내용과 방법에 대한 설명 | ||
> | ||
- | ||
- | ||
## 📝 반영 브랜치 | ||
<!-- feat/#issue -> dev와 같이 반영 브랜치를 표시합니다 --> | ||
<!-- closed #issue로 merge되면 issue가 자동으로 close되게 해줍니다 --> | ||
- feat/ | ||
- closed | ||
|
||
# 리뷰 필요 | ||
## 📝 변경 사항 | ||
<!-- 로그인 시, 구글 소셜 로그인 기능을 추가했습니다. 와 같이 작성합니다 --> | ||
|
||
> 나중에 다시 고민해야할 내용이 있는 내용 | ||
> | ||
> 없을 경우 작성 X | ||
|
||
> 있을 경우 작성 후 이슈 남기고 해당 PR 링크 | ||
> | ||
- | ||
- | ||
## 📝 테스트 결과 | ||
<!-- local에서 postman으로 요청한 결과를 첨부합니다, postman을 사용하지 않으면 관련 화면 캡쳐 --> | ||
|
||
close | ||
|
||
## 📝 To Reviewer | ||
<!-- review 받고 싶은 point를 작성합니다 --> |
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,78 @@ | ||
package synk.meeteam.domain.auth.api; | ||
|
||
|
||
import io.swagger.v3.oas.annotations.Operation; | ||
import io.swagger.v3.oas.annotations.responses.ApiResponse; | ||
import io.swagger.v3.oas.annotations.responses.ApiResponses; | ||
import io.swagger.v3.oas.annotations.tags.Tag; | ||
import jakarta.servlet.http.HttpServletRequest; | ||
import jakarta.validation.Valid; | ||
import org.springframework.http.ResponseEntity; | ||
import org.springframework.web.bind.annotation.RequestBody; | ||
import org.springframework.web.bind.annotation.RequestHeader; | ||
import synk.meeteam.domain.auth.dto.request.AuthUserRequestDto; | ||
import synk.meeteam.domain.auth.dto.request.#UserRequestDto; | ||
import synk.meeteam.domain.auth.dto.request.VerifyUserRequestDto; | ||
import synk.meeteam.domain.auth.dto.response.AuthUserResponseDto; | ||
import synk.meeteam.domain.auth.dto.response.LogoutUserResponseDto; | ||
import synk.meeteam.domain.auth.dto.response.ReissueUserResponseDto; | ||
import synk.meeteam.domain.auth.dto.response.#UserResponseDto; | ||
import synk.meeteam.domain.user.entity.User; | ||
import synk.meeteam.security.AuthUser; | ||
|
||
|
||
@Tag(name = "auth", description = "인증 관련 API") | ||
public interface AuthApi { | ||
|
||
@ApiResponses( | ||
value = { | ||
@ApiResponse(responseCode = "200", description = "로그인에 성공하였습니다"), | ||
@ApiResponse(responseCode = "201", description = "회원가입에 성공하였습니다"), | ||
@ApiResponse(responseCode = "400", description = "유효하지 않은 플랫폼 인가코드입니다, 입력값이 올바르지 않습니다, 올바르지 않은 플랫폼 유형입니다") | ||
} | ||
) | ||
@Operation(summary = "소셜 로그인(1)") | ||
ResponseEntity<AuthUserResponseDto> login( | ||
@RequestHeader(value = "authorization-code") final String authorizationCode, | ||
@RequestBody @Valid final | ||
AuthUserRequestDto requestDto); | ||
|
||
|
||
@ApiResponses( | ||
value = { | ||
@ApiResponse(responseCode = "200", description = "임시 유저 생성 및 이메일 전송에 성공하였습니다."), | ||
} | ||
) | ||
@Operation(summary = "임시 유저 생성 및 이메일 전송(2)") | ||
ResponseEntity<#UserResponseDto> createTempUserAndSendEmail( | ||
@RequestBody @Valid #UserRequestDto requestDto | ||
); | ||
|
||
@ApiResponses( | ||
value = { | ||
@ApiResponse(responseCode = "200", description = "이메일 인증 및 회원가입에 성공하였습니다."), | ||
} | ||
) | ||
@Operation(summary = "이메일 인증 및 회원가입(3)") | ||
ResponseEntity<AuthUserResponseDto> #( | ||
@RequestBody @Valid VerifyUserRequestDto requestDto); | ||
|
||
|
||
@ApiResponses( | ||
value = { | ||
@ApiResponse(responseCode = "200", description = "리프레시 토큰 재발급에 성공하였습니다."), | ||
@ApiResponse(responseCode = "400", description = "서비스에서 발급되지 않거나 이미 사용된 리프레시 토큰입니다."), | ||
@ApiResponse(responseCode = "401", description = "기한이 만료된 리프레시 토큰입니다.") | ||
} | ||
) | ||
@Operation(summary = "액세스 토큰 & 리프레시 토큰 재발급", description = "액세스 토큰 및 리프레시 토큰을 재발급 받습니다.") | ||
ResponseEntity<ReissueUserResponseDto> reissue(HttpServletRequest request); | ||
|
||
@ApiResponses( | ||
value = { | ||
@ApiResponse(responseCode = "200", description = "로그아웃에 성공하였습니다."), | ||
} | ||
) | ||
@Operation(summary = "로그아웃") | ||
ResponseEntity<LogoutUserResponseDto> logout(@AuthUser final User user); | ||
} |
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
7 changes: 0 additions & 7 deletions
7
src/main/java/synk/meeteam/domain/auth/api/dto/request/UserAuthRequestDTO.java
This file was deleted.
Oops, something went wrong.
15 changes: 0 additions & 15 deletions
15
src/main/java/synk/meeteam/domain/auth/api/dto/request/User#RequestDTO.java
This file was deleted.
Oops, something went wrong.
12 changes: 0 additions & 12 deletions
12
src/main/java/synk/meeteam/domain/auth/api/dto/request/UserVerifyRequestDTO.java
This file was deleted.
Oops, something went wrong.
13 changes: 0 additions & 13 deletions
13
src/main/java/synk/meeteam/domain/auth/api/dto/response/UserAuthResponseDTO.java
This file was deleted.
Oops, something went wrong.
10 changes: 0 additions & 10 deletions
10
src/main/java/synk/meeteam/domain/auth/api/dto/response/UserReissueResponseDTO.java
This file was deleted.
Oops, something went wrong.
11 changes: 0 additions & 11 deletions
11
src/main/java/synk/meeteam/domain/auth/api/dto/response/User#ResponseDTO.java
This file was deleted.
Oops, something went wrong.
13 changes: 13 additions & 0 deletions
13
src/main/java/synk/meeteam/domain/auth/dto/request/AuthUserRequestDto.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,13 @@ | ||
package synk.meeteam.domain.auth.dto.request; | ||
|
||
import io.swagger.v3.oas.annotations.media.Schema; | ||
import jakarta.validation.constraints.NotNull; | ||
import synk.meeteam.domain.user.entity.enums.PlatformType; | ||
|
||
@Schema(name = "AuthUserRequestDto", description = "소셜 로그인 요청 Dto") | ||
public record AuthUserRequestDto( | ||
@NotNull | ||
@Schema(description = "소셜 플랫폼 타입", example = "NAVER") | ||
PlatformType platformType) { | ||
|
||
} |
30 changes: 30 additions & 0 deletions
30
src/main/java/synk/meeteam/domain/auth/dto/request/#UserRequestDto.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,30 @@ | ||
package synk.meeteam.domain.auth.dto.request; | ||
|
||
import io.swagger.v3.oas.annotations.media.Schema; | ||
import jakarta.validation.constraints.NotNull; | ||
import synk.meeteam.domain.user.entity.enums.PlatformType; | ||
|
||
@Schema(name = "#UserRequestDto", description = "임시 회원 가입 및 이메일 인증 요청 Dto") | ||
public record #UserRequestDto( | ||
|
||
@NotNull | ||
@Schema(description = "플랫폼 Id", example = "Di7lChMGxjZVTai6d76Ho1YLDU_xL8tl1CfdPMV5SQM") | ||
String platformId, | ||
@NotNull | ||
@Schema(description = "플랫폼 타입", example = "NAVER") | ||
PlatformType platformType, | ||
@NotNull | ||
@Schema(description = "학사 이메일", example = "thdalsrb123@kw.ac.kr") | ||
String email, | ||
@NotNull | ||
@Schema(description = "학교 이름", example = "광운대학교") | ||
String universityName, | ||
@NotNull | ||
@Schema(description = "학과 이름", example = "소프트웨어학부") | ||
String departmentName, | ||
@NotNull | ||
@Schema(description = "입학년도", example = "2018") | ||
int admissionYear | ||
|
||
) { | ||
} |
Oops, something went wrong.