Skip to content

Commit

Permalink
Merge pull request #140 from SW13-Monstera/dev
Browse files Browse the repository at this point in the history
Hotfix Release
  • Loading branch information
kshired authored Nov 25, 2023
2 parents 89c2aa2 + c4dd42a commit 268f634
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,12 @@ class LoginUserArgumentResolver(
): Any {
val authentication = SecurityContextHolder.getContext().authentication

if (authentication == null || authentication.principal.equals("anonymousUser")) {
if (authentication == null || authentication.principal == "anonymousUser") {
throw UnAuthorizedException(ErrorCode.UNAUTHORIZED, "로그인이 필요합니다.")
}
val email = authentication.name
val email = authentication.principal?.let {
it as? org.springframework.security.core.userdetails.User
}?.username ?: throw UnAuthorizedException(ErrorCode.UNAUTHORIZED, "로그인이 필요합니다.")

return userRepository.findByEmail(email)
?: throw UnAuthorizedException(ErrorCode.NOT_FOUND_ENTITY, "알 수 없는 유저의 요청입니다.")
Expand Down

0 comments on commit 268f634

Please sign in to comment.