-
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 #51 from Kakaotech-18-Ecommerce/SCRUM-77-Entity-In…
…heritance-Problem Scrum 77 entity inheritance problem
- Loading branch information
Showing
34 changed files
with
723 additions
and
635 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
1 change: 0 additions & 1 deletion
1
src/main/java/com/kakaoteck/golagola/config/SecurityConfig.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
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
53 changes: 19 additions & 34 deletions
53
src/main/java/com/kakaoteck/golagola/domain/auth/controller/AuthController.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,50 +1,35 @@ | ||
package com.kakaoteck.golagola.domain.auth.controller; | ||
|
||
|
||
import com.kakaoteck.golagola.domain.auth.dto.AuthRequest; | ||
import com.kakaoteck.golagola.domain.auth.dto.AuthResponse; | ||
import com.kakaoteck.golagola.domain.auth.dto.JoinUserRequest; | ||
import com.kakaoteck.golagola.domain.auth.service.AuthService; | ||
import com.kakaoteck.golagola.domain.auth.dto.CustomOAuth2User; | ||
import com.kakaoteck.golagola.domain.auth.service.AuthService1; | ||
import com.kakaoteck.golagola.global.common.ApiResponse; | ||
import io.swagger.v3.oas.annotations.Operation; | ||
import jakarta.servlet.http.HttpServletRequest; | ||
import jakarta.servlet.http.HttpServletResponse; | ||
import org.springframework.web.bind.annotation.*; | ||
|
||
import lombok.RequiredArgsConstructor; | ||
|
||
import java.io.IOException; | ||
import org.springframework.security.core.context.SecurityContextHolder; | ||
import org.springframework.web.bind.annotation.PostMapping; | ||
import org.springframework.web.bind.annotation.RequestBody; | ||
import org.springframework.web.bind.annotation.RequestMapping; | ||
import org.springframework.web.bind.annotation.RestController; | ||
|
||
@RequiredArgsConstructor | ||
@RequestMapping("/api/v1/auth") | ||
@RestController | ||
@CrossOrigin("*") | ||
@RequestMapping("/api/v1/auth") | ||
public class AuthController { | ||
|
||
private final AuthService authService; | ||
private final AuthService1 authService; | ||
|
||
@Operation(summary = "회원가입 기능", description = "gender 값: MALE or FEMALE") | ||
@Operation(summary = "회원가입 추가정보 진행", description = "(nickname, gender) 저장") | ||
@PostMapping("/join") | ||
public ApiResponse<String> join(@RequestBody JoinUserRequest request) { | ||
authService.register(request); | ||
return ApiResponse.onSuccess("회원가입 성공"); | ||
} | ||
public ApiResponse<String> join(@RequestBody AuthRequest authRequest) { | ||
// 1. jwt 세션 접근 | ||
CustomOAuth2User customUser = (CustomOAuth2User) SecurityContextHolder.getContext().getAuthentication().getPrincipal(); | ||
String username = customUser.getUsername(); | ||
|
||
@Operation(summary = "이메일 중복 검사 버튼", description = "회원가입 과정에서 이메일 중복 검사를 진행합니다.\ntrue = 이미 존재하는 이메일, false = 가입 가능한 이메일") | ||
@GetMapping("/join/email-check/{email}") | ||
public ApiResponse<?> checkEmailExists( | ||
@PathVariable(name = "email") String email | ||
) { | ||
return ApiResponse.onSuccess(authService.checkEmailExists(email)); | ||
} | ||
// 2. UserService를 통해 (nickname, gender) 저장 | ||
authService.saveUserDetails(username, authRequest); | ||
|
||
@PostMapping("/login") | ||
public ApiResponse<AuthResponse> login(@RequestBody AuthRequest request) { | ||
return ApiResponse.onSuccess(authService.authenticate(request)); | ||
} | ||
|
||
@Operation(summary = "리프레시 토큰 발급") | ||
@PostMapping("/refresh-token") | ||
public void refreshToken(HttpServletRequest request, HttpServletResponse response) throws IOException { | ||
authService.refreshToken(request, response); | ||
return ApiResponse.onSuccess("회원가입 성공"); | ||
} | ||
} | ||
} |
8 changes: 6 additions & 2 deletions
8
src/main/java/com/kakaoteck/golagola/domain/auth/dto/AuthRequest.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,7 +1,11 @@ | ||
package com.kakaoteck.golagola.domain.auth.dto; | ||
|
||
import com.kakaoteck.golagola.global.common.enums.Gender; | ||
import com.kakaoteck.golagola.global.common.enums.Role; | ||
|
||
public record AuthRequest( | ||
String email, | ||
String password | ||
String nickName, | ||
Gender gender | ||
// Role role | ||
) { | ||
} |
34 changes: 32 additions & 2 deletions
34
src/main/java/com/kakaoteck/golagola/domain/auth/dto/CustomOAuth2User.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
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
11 changes: 11 additions & 0 deletions
11
src/main/java/com/kakaoteck/golagola/domain/auth/dto/OAuth2KakaoResponse.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,11 @@ | ||
package com.kakaoteck.golagola.domain.auth.dto; | ||
|
||
public interface OAuth2KakaoResponse { | ||
|
||
String getProvider(); //제공자 (Ex. naver, google, ...) | ||
String getProviderId(); //제공자에서 발급해주는 아이디(번호) | ||
String getEmail(); //이메일 | ||
String getName(); //사용자 실명 (설정한 이름) | ||
String getImage(); //사용자 실명 (설정한 이름) | ||
|
||
} |
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.