Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions divinespark-backend/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -42,3 +42,4 @@ src/main/resources/application-*.properties
*.env

notepad .gitignore
app.log
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ protected void doFilterInternal(HttpServletRequest request,
FilterChain filterChain)
throws ServletException, IOException {

String path = request.getServletPath();
String path = request.getRequestURI();

// Skip JWT for public endpoints
if (isPublicEndpoint(path)) {
Expand Down Expand Up @@ -166,14 +166,19 @@ protected void doFilterInternal(HttpServletRequest request,
filterChain.doFilter(request, response);
}

//Define PUBLIC APIs here
private boolean isPublicEndpoint(String path) {
return path.startsWith("/api/v1/auth")
|| path.startsWith("/api/v1/sessions")
|| path.startsWith("/api/v1/blogs")
|| path.startsWith("/api/v1/public")
|| path.startsWith("/api/v1/user/review")
|| path.startsWith("/v3/api-docs")
|| path.startsWith("/swagger-ui");
}
}

return path.startsWith("/api/v1/auth/")
|| path.equals("/api/v1/auth")

|| path.startsWith("/api/v1/sessions/")
|| path.equals("/api/v1/sessions")

|| path.startsWith("/api/v1/blogs/")
|| path.startsWith("/api/v1/public/")
|| path.startsWith("/api/v1/user/review/")

|| path.startsWith("/v3/api-docs")
|| path.startsWith("/swagger-ui");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ public SecurityFilterChain securityFilterChain(HttpSecurity http) throws Excepti

// PUBLIC: session browsing & reviews (NO LOGIN)
.requestMatchers(
HttpMethod.GET,
"/api/v1/sessions/**",
"/api/v1/user/review/**",
"/api/v1/blogs/**"
Expand Down