-
Notifications
You must be signed in to change notification settings - Fork 0
사용자 로그인 풀림 이슈 해결 #55
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
사용자 로그인 풀림 이슈 해결 #55
Changes from all commits
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 |
|---|---|---|
|
|
@@ -175,8 +175,7 @@ class AuthService( | |
| val sessionId = jwtTokenProvider.extractSessionIdFromRefreshToken(refreshToken) | ||
| val validSession = loginSessionStore.validateRefreshToken(sessionId, userId, refreshToken) | ||
| if (!validSession) { | ||
| loginSessionStore.delete(sessionId) | ||
| throw unauthorizedException() | ||
| throw refreshUnauthorizedException() | ||
|
Comment on lines
177
to
+178
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.
When Useful? React with 👍 / 👎. |
||
| } | ||
|
Comment on lines
177
to
179
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. 리프레시 토큰 검증 실패 시 세션을 삭제하지 않도록 변경하면 여러 탭/기기에서의 사용자 경험이 향상될 수 있습니다. 하지만 이는 보안상 중요한 '리프레시 토큰 재사용 탐지' 기능을 약화시킬 수 있습니다. 토큰 회전(rotation) 전략에서 이전에 사용된 토큰이 다시 등장하는 것은 토큰 탈취의 강력한 신호로 간주됩니다. 이 경우, 보안 강화를 위해 해당 세션을 즉시 만료시키는 것이 좋습니다. 기존의 |
||
|
|
||
| val user = userRepository.findById(userId).orElseThrow { unauthorizedException() } | ||
|
|
@@ -247,6 +246,10 @@ class AuthService( | |
| return ResponseStatusException(HttpStatus.UNAUTHORIZED, "이메일 또는 비밀번호가 올바르지 않습니다.") | ||
| } | ||
|
|
||
| private fun refreshUnauthorizedException(): ResponseStatusException { | ||
| return ResponseStatusException(HttpStatus.UNAUTHORIZED, "인증이 만료되었습니다. 다시 로그인해 주세요.") | ||
| } | ||
|
|
||
| private fun resolveSocialName(nameHint: String?, email: String): String { | ||
| val trimmedName = nameHint?.trim().orEmpty() | ||
| if (trimmedName.isNotBlank()) { | ||
|
|
||
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.
JVM의 기본 시간대를
main함수에서 직접 설정하는 것보다 Spring의 생명주기에 맞춰 관리하는 것이 더 좋습니다. 설정을 중앙에서 관리하고 테스트 용이성을 높이기 위해, 이 로직을@SpringBootApplication클래스 내부에@PostConstruct어노테이션을 사용한 초기화 메서드로 옮기는 것을 고려해 보세요. 이렇게 하면 애플리케이션의 진입점(entry point)을 더 깔끔하게 유지할 수 있습니다.