-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
#270 [fix] /authorize 명세 수정 #271
Changes from 4 commits
e6685d4
4295dae
24e49b3
fa92952
0859f5d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,24 @@ | ||
package org.sopt.makers.operation.auth.api; | ||
|
||
import static org.sopt.makers.operation.code.failure.auth.AuthFailureCode.EXPIRED_PLATFORM_CODE; | ||
import static org.sopt.makers.operation.code.failure.auth.AuthFailureCode.EXPIRED_REFRESH_TOKEN; | ||
import static org.sopt.makers.operation.code.failure.auth.AuthFailureCode.INVALID_GRANT_TYPE; | ||
import static org.sopt.makers.operation.code.failure.auth.AuthFailureCode.INVALID_SOCIAL_TYPE; | ||
import static org.sopt.makers.operation.code.failure.auth.AuthFailureCode.NOT_FOUNT_REGISTERED_TEAM; | ||
import static org.sopt.makers.operation.code.failure.auth.AuthFailureCode.NOT_NULL_CODE; | ||
import static org.sopt.makers.operation.code.failure.auth.AuthFailureCode.NOT_NULL_GRANT_TYPE; | ||
import static org.sopt.makers.operation.code.failure.auth.AuthFailureCode.NOT_NULL_REFRESH_TOKEN; | ||
import static org.sopt.makers.operation.code.failure.auth.AuthFailureCode.USED_PLATFORM_CODE; | ||
import static org.sopt.makers.operation.code.success.auth.AuthSuccessCode.SUCCESS_GENERATE_TOKEN; | ||
import static org.sopt.makers.operation.code.success.auth.AuthSuccessCode.SUCCESS_RETURN_REDIRECT_URL_WITH_PLATFORM_CODE; | ||
import static org.sopt.makers.operation.jwt.JwtTokenType.PLATFORM_CODE; | ||
import static org.sopt.makers.operation.jwt.JwtTokenType.REFRESH_TOKEN; | ||
|
||
import java.util.concurrent.ConcurrentHashMap; | ||
import lombok.RequiredArgsConstructor; | ||
import lombok.val; | ||
import org.sopt.makers.operation.auth.dto.request.AccessTokenRequest; | ||
import org.sopt.makers.operation.auth.dto.response.AuthorizationCodeResponse; | ||
import org.sopt.makers.operation.auth.dto.response.RedirectUrlResponse; | ||
import org.sopt.makers.operation.auth.dto.response.TokenResponse; | ||
import org.sopt.makers.operation.auth.service.AuthService; | ||
import org.sopt.makers.operation.dto.BaseResponse; | ||
|
@@ -20,29 +35,14 @@ | |
import org.springframework.web.bind.annotation.RequestParam; | ||
import org.springframework.web.bind.annotation.RestController; | ||
|
||
import java.util.concurrent.ConcurrentHashMap; | ||
|
||
import static org.sopt.makers.operation.code.failure.auth.AuthFailureCode.EXPIRED_PLATFORM_CODE; | ||
import static org.sopt.makers.operation.code.failure.auth.AuthFailureCode.EXPIRED_REFRESH_TOKEN; | ||
import static org.sopt.makers.operation.code.failure.auth.AuthFailureCode.INVALID_GRANT_TYPE; | ||
import static org.sopt.makers.operation.code.failure.auth.AuthFailureCode.INVALID_SOCIAL_TYPE; | ||
import static org.sopt.makers.operation.code.failure.auth.AuthFailureCode.NOT_FOUNT_REGISTERED_TEAM; | ||
import static org.sopt.makers.operation.code.failure.auth.AuthFailureCode.NOT_NULL_CODE; | ||
import static org.sopt.makers.operation.code.failure.auth.AuthFailureCode.NOT_NULL_GRANT_TYPE; | ||
import static org.sopt.makers.operation.code.failure.auth.AuthFailureCode.NOT_NULL_REFRESH_TOKEN; | ||
import static org.sopt.makers.operation.code.failure.auth.AuthFailureCode.USED_PLATFORM_CODE; | ||
import static org.sopt.makers.operation.code.success.auth.AuthSuccessCode.SUCCESS_GENERATE_TOKEN; | ||
import static org.sopt.makers.operation.code.success.auth.AuthSuccessCode.SUCCESS_GET_AUTHORIZATION_CODE; | ||
import static org.sopt.makers.operation.jwt.JwtTokenType.PLATFORM_CODE; | ||
import static org.sopt.makers.operation.jwt.JwtTokenType.REFRESH_TOKEN; | ||
|
||
@RestController | ||
@RequiredArgsConstructor | ||
@RequestMapping("/api/v1/auth") | ||
public class AuthApiController implements AuthApi { | ||
|
||
private static final String AUTHORIZATION_CODE_GRANT_TYPE = "authorizationCode"; | ||
private static final String REFRESH_TOKEN_GRANT_TYPE = "refreshToken"; | ||
private static final String REDIRECT_URL_WITH_CODE_TEMPLATE = "%s?code=%s"; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
네이밍을 Template으로 가져가신 이유가 무엇인가요?! There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 저 때 template이란 단어가 생각나서 사용했습니다. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @KWY0218 아무래도 정규식을 사용하고 실제 급한 부분은 아니니 만약 동의하신다면 추후 커밋에 슬-쩍 포함해서 변경해주셔도 무관할 것 같습니다!! 👍 |
||
|
||
private final ConcurrentHashMap<String, String> tempPlatformCode; | ||
private final AuthService authService; | ||
|
@@ -65,7 +65,8 @@ public ResponseEntity<BaseResponse<?>> authorize( | |
|
||
val userId = findUserIdBySocialTypeAndCode(type, code); | ||
val platformCode = generatePlatformCode(clientId, redirectUri, userId); | ||
return ApiResponseUtil.success(SUCCESS_GET_AUTHORIZATION_CODE, new AuthorizationCodeResponse(platformCode)); | ||
val redirectUrl = String.format(REDIRECT_URL_WITH_CODE_TEMPLATE, redirectUri, platformCode); | ||
return ApiResponseUtil.success(SUCCESS_RETURN_REDIRECT_URL_WITH_PLATFORM_CODE, new RedirectUrlResponse(redirectUrl)); | ||
} | ||
|
||
@Override | ||
|
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
package org.sopt.makers.operation.auth.dto.response; | ||
|
||
public record RedirectUrlResponse(String redirectUrl) { | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
P4
static import 문을 import 선언 섹션의 최하단이 아닌 최상단으로 옮기신 이유가 따로 있나요?!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
자동 정렬이 시켰습니다..!
다시 변경할까 싶었는데, 변수를 선언할 때도 항상 상수를 위에 다 정의한 것이 떠올라 커밋했습니다..!