Skip to content

Commit

Permalink
fix: Login Provider를 String type으로 받는다.
Browse files Browse the repository at this point in the history
  • Loading branch information
rlarltj committed Aug 6, 2024
1 parent b397ebf commit 34b22f6
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import lombok.RequiredArgsConstructor;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

Expand All @@ -29,7 +30,7 @@ public class AuthController {

@Operation(summary = "로그인")
@GetMapping("/sign-in")
public ResponseEntity<Tokens> signIn(LoginRequest loginRequest) {
public ResponseEntity<Tokens> signIn(@RequestBody LoginRequest loginRequest) {
OAuthUserDataResponse oAuthUserData = oAuthService.login(loginRequest);

OAuthUserInfo oAuthUserInfo = OAuthUserInfo.from(oAuthUserData);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
package com.dnd.accompany.domain.auth.oauth.dto;

import com.dnd.accompany.domain.auth.oauth.service.OAuthProvider;

public record LoginRequest(
OAuthProvider provider,
String provider,
String accessToken
) {
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ public enum OAuthProvider {

private final String name;

public static OAuthProvider get(OAuthProvider oAuthProvider) {
public static OAuthProvider get(String name) {
return Arrays.stream(OAuthProvider.values())
.filter(provider -> provider.equals(oAuthProvider))
.filter(provider -> provider.getName().equals(name))
.findAny()
.orElseThrow(() -> new NotFoundException(ErrorCode.INVALID_PROVIDER));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import org.springframework.security.core.annotation.AuthenticationPrincipal;
import org.springframework.web.bind.annotation.GetMapping;
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;

Expand All @@ -25,7 +26,7 @@ public class UserProfileController {
@Operation(summary = "온보딩 정보 저장")
@PostMapping
public void createUserProfile(@AuthenticationPrincipal JwtAuthentication user,
@Valid CreateUserProfileRequest createUserProfileRequest
@RequestBody @Valid CreateUserProfileRequest createUserProfileRequest
) {
userProfileService.createUserProfile(user.getId(), createUserProfileRequest);
}
Expand Down

0 comments on commit 34b22f6

Please sign in to comment.