Skip to content

Commit

Permalink
fix : update userId 추출 코드 변경
Browse files Browse the repository at this point in the history
  • Loading branch information
YoungGyo-00 committed Feb 1, 2024
1 parent c70d7fd commit 5f062fe
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,13 @@ public LoginResponseDto login(String code, String redirectUri) {

public Long getUserId() {
Authentication authentication = SecurityContextHolder.getContext().getAuthentication();

if (authentication != null) {
CustomAuthenticationDetails customDetails = (CustomAuthenticationDetails) authentication.getDetails();
return customDetails.getUserId();
Object details = authentication.getDetails();
if (details instanceof CustomAuthenticationDetails) {
CustomAuthenticationDetails customDetails = (CustomAuthenticationDetails) details;
return customDetails.getUserId();
}
}

return null; // 인증 정보가 없거나 CustomAuthenticationDetails를 사용하지 않는 경우
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ public class ChatGptController {
private final ChatGptService chatGptService;
private final OAuthService oAuthService;

@SecurityRequirement(name = "Authorization")
@Operation(summary = "ChatGPT로 원하는 브랜드 만들기")
@PostMapping("/question")
public ApiResponse<ChatGptCreationResultDto> postChat(@RequestBody ChatGptRequest chatGptRequest) throws JsonProcessingException {
Expand Down

0 comments on commit 5f062fe

Please sign in to comment.