-
Notifications
You must be signed in to change notification settings - Fork 1
[BE-Fix] 로그인 url을 jwt 인증 필터에서 제외 #175
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
Conversation
사용하지 않는 코드 삭제
WalkthroughThis pull request removes several legacy annotations and components related to Google login functionality and OAuth callbacks. The OAuth callback method in the authentication controller no longer includes summary or description annotations. The dedicated URL response record and corresponding methods for generating the Google login URL have been removed across the controllers and services, along with their tests. Additionally, the JWT authentication filter has been updated to exclude the Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant JwtAuthFilter
participant Application
User->>JwtAuthFilter: Send request (e.g. "/api/v1/login")
alt Request is "/api/v1/login"
JwtAuthFilter-->>User: Bypass JWT validation
User->>Application: Process login request
else Other endpoint
JwtAuthFilter->>JwtAuthFilter: Validate JWT token
JwtAuthFilter-->>User: Forward request if valid
end
Possibly related PRs
Suggested reviewers
Poem
✨ Finishing Touches
🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
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.
Actionable comments posted: 0
🧹 Nitpick comments (2)
backend/src/main/java/endolphin/backend/global/security/JwtAuthFilter.java (2)
23-55: LGTM! Consider extracting token parsing logic.The JWT token validation and user context management implementation is solid. The error handling is appropriate, and ThreadLocal cleanup is properly handled.
Consider extracting the token parsing logic into a separate method for better readability:
@Override protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain filterChain) throws ServletException, IOException { - String token = request.getHeader("Authorization"); - if (token != null && token.startsWith("Bearer ")) { - token = token.substring(7); + String token = extractToken(request); + if (token != null) { try { var signedJwt = jwtProvider.validateToken(token); // ... rest of the code ... } } } + private String extractToken(HttpServletRequest request) { + String token = request.getHeader("Authorization"); + return (token != null && token.startsWith("Bearer ")) ? token.substring(7) : null; + }
70-71: Consider using more precise path matching.Using
startsWithfor path matching could be too permissive. For example,/api/v1/login-historywould also be excluded from authentication.Consider using exact path matching or AntPathMatcher for more precise control:
- return "OPTIONS".equalsIgnoreCase(request.getMethod()) || - excludedPaths.stream().anyMatch(path::startsWith); + AntPathMatcher pathMatcher = new AntPathMatcher(); + return "OPTIONS".equalsIgnoreCase(request.getMethod()) || + excludedPaths.stream().anyMatch(pattern -> pathMatcher.match(pattern + "/**", path));
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (6)
backend/src/main/java/endolphin/backend/domain/auth/AuthController.java(0 hunks)backend/src/main/java/endolphin/backend/domain/auth/dto/UrlResponse.java(0 hunks)backend/src/main/java/endolphin/backend/global/google/GoogleController.java(0 hunks)backend/src/main/java/endolphin/backend/global/google/GoogleOAuthService.java(0 hunks)backend/src/main/java/endolphin/backend/global/security/JwtAuthFilter.java(1 hunks)backend/src/test/java/endolphin/backend/global/google/GoogleOAuthServiceTest.java(0 hunks)
💤 Files with no reviewable changes (5)
- backend/src/main/java/endolphin/backend/domain/auth/dto/UrlResponse.java
- backend/src/main/java/endolphin/backend/global/google/GoogleOAuthService.java
- backend/src/main/java/endolphin/backend/domain/auth/AuthController.java
- backend/src/main/java/endolphin/backend/global/google/GoogleController.java
- backend/src/test/java/endolphin/backend/global/google/GoogleOAuthServiceTest.java
⏰ Context from checks skipped due to timeout of 90000ms (1)
- GitHub Check: Send PR Notification to Reviewers
🔇 Additional comments (1)
backend/src/main/java/endolphin/backend/global/security/JwtAuthFilter.java (1)
61-68: LGTM! Login path exclusion is appropriate.Excluding the login endpoint from JWT authentication is necessary to allow users to authenticate. The other excluded paths are also appropriate for their respective purposes.
efdao
left a comment
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.
고생하셨습니다.
#️⃣ 연관된 이슈>
📝 작업 내용> 이번 PR에서 작업한 내용을 간략히 설명해주세요(이미지 첨부 가능)
🙏 여기는 꼭 봐주세요! > 리뷰어가 특별히 봐주었으면 하는 부분이 있다면 작성해주세요
Summary by CodeRabbit
Refactor
Tests