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
Original file line number Diff line number Diff line change
Expand Up @@ -114,8 +114,7 @@ public CorsConfiguration getCorsConfiguration(HttpServletRequest request) {
// κ²½λ‘œλ³„ 인가 μž‘μ—…
http
.authorizeHttpRequests(auth -> auth
// .requestMatchers("/", "/refresh-token", "/register", "/first-register", "/api/timetable/**", "/test", "/api/document/download/{documentId:\\d+}").permitAll()
.requestMatchers("/", "/refresh-token", "/register", "/first-register", "/api/timetable/**", "/test").permitAll()
.requestMatchers("/", "/refresh-token", "/register", "/first-register", "/api/timetable/**", "/test", "/swagger-ui/**").permitAll()
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

πŸ’‘ Verification agent

🧩 Analysis chain

Swagger UI만 ν—ˆμš©ν•˜λ©΄ μŠ€νŽ™(/v3/api-docs)이 401 β€” api-docs도 permitAll ν•„μš”

Swagger UIλŠ” 기본적으둜 /v3/api-docs(및 /v3/api-docs/**)μ—μ„œ μŠ€νŽ™μ„ λΆˆλŸ¬μ˜΅λ‹ˆλ‹€. ν˜„μž¬ /swagger-ui/**만 열어두면 UIλŠ” λœ¨μ§€λ§Œ μŠ€νŽ™ 호좜이 401둜 λ§‰ν˜€ μ‹€μ œ 화면에 APIκ°€ ν‘œμ‹œλ˜μ§€ μ•ŠμŠ΅λ‹ˆλ‹€. μ•„λž˜μ²˜λŸΌ "/v3/api-docs/**"(ν•„μš”μ‹œ "/swagger-ui.html")도 ν•¨κ»˜ ν—ˆμš©ν•΄ μ£Όμ„Έμš”.

-                        .requestMatchers("/", "/refresh-token", "/register", "/first-register", "/api/timetable/**", "/test", "/swagger-ui/**").permitAll()
+                        .requestMatchers("/", "/refresh-token", "/register", "/first-register", "/api/timetable/**", "/test",
+                                         "/swagger-ui/**", "/swagger-ui.html", "/v3/api-docs/**").permitAll()

μŠ€νŽ™ 경둜λ₯Ό springdoc.api-docs.path둜 μ»€μŠ€ν…€ν–ˆλ‹€λ©΄ ν•΄λ‹Ή 경둜둜 μΉ˜ν™˜μ΄ ν•„μš”ν•©λ‹ˆλ‹€.


🏁 Script executed:

#!/bin/bash
rg -nP --color=never 'requestMatchers' -C3 src/main/java/hello/cluebackend/global/config/SecurityConfig.java || true
rg -n 'springdoc.api-docs.path' -n -g '*.properties' -g '*.yml' -g '*.yaml' || true

Length of output: 519


/v3/api-docs/** 및 /swagger-ui.html도 permitAll에 μΆ”κ°€
SecurityConfig.java 117ν–‰μ˜ .requestMatchers(..., "/swagger-ui/**").permitAll()에 /v3/api-docs/**와 ν•„μš” μ‹œ /swagger-ui.html을 μΆ”κ°€ν•΄μ•Ό Swagger UIκ°€ API μŠ€νŽ™μ„ 정상 ν‘œμ‹œν•©λ‹ˆλ‹€.

- .requestMatchers("/", "/refresh-token", "/register", "/first-register", "/api/timetable/**", "/test", "/swagger-ui/**").permitAll()
+ .requestMatchers("/", "/refresh-token", "/register", "/first-register", "/api/timetable/**", "/test",
+                  "/swagger-ui/**", "/swagger-ui.html", "/v3/api-docs/**").permitAll()

(μ»€μŠ€ν…€ springdoc.api-docs.pathλ₯Ό μ‚¬μš© 쀑이라면 ν•΄λ‹Ή κ°’μœΌλ‘œ /v3/api-docs/**λ₯Ό λŒ€μ²΄ν•΄μ£Όμ„Έμš”.)

πŸ“ Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
.requestMatchers("/", "/refresh-token", "/register", "/first-register", "/api/timetable/**", "/test", "/swagger-ui/**").permitAll()
.requestMatchers("/", "/refresh-token", "/register", "/first-register", "/api/timetable/**", "/test",
"/swagger-ui/**", "/swagger-ui.html", "/v3/api-docs/**").permitAll()
πŸ€– Prompt for AI Agents
In src/main/java/hello/cluebackend/global/config/SecurityConfig.java around line
117, the requestMatchers permit list currently allows "/swagger-ui/**" but is
missing "/v3/api-docs/**" and optionally "/swagger-ui.html", so add
"/v3/api-docs/**" (or your custom springdoc.api-docs.path + "/**") and
"/swagger-ui.html" to the requestMatchers list to ensure Swagger UI and API docs
are served without authentication.

.anyRequest().authenticated());


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public OpenAPI openAPI() {

private Info apiInfo() {
return new Info()
.title("CodeArena Swagger")
.title("Clue Swagger")
.description("CLUE REST API")
.version("1.0.0");
}
Expand Down
Loading