Skip to content

Commit 982a9b0

Browse files
committed
fix: security 오류 해결
1 parent 7a42f6a commit 982a9b0

File tree

3 files changed

+6
-3
lines changed

3 files changed

+6
-3
lines changed

src/main/java/com/example/log4u/common/config/SecurityConfig.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,9 @@ public SecurityFilterChain filterChain(HttpSecurity http) throws Exception {
7272
.authorizeHttpRequests(auth -> auth
7373
// 소셜 로그인 경로
7474
.requestMatchers("/oauth2/**").permitAll()
75-
// Swagger UI 관련 경로 (swagger-ui.html 추가)
75+
// 테스트용 인증/인가 경로
7676
.requestMatchers("/users/dev").permitAll()
77+
// Swagger UI 관련 경로 (swagger-ui.html 추가)
7778
.requestMatchers("/swagger-ui.html", "/swagger-ui/**", "/v3/api-docs/**").permitAll()
7879
.anyRequest().authenticated());
7980

src/main/java/com/example/log4u/common/oauth2/jwt/JwtAuthenticationFilter.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,10 @@ protected void doFilterInternal(
7777
private boolean shouldSkipFilter(String requestUri) {
7878
return requestUri.matches("^/login(/.*)?$")
7979
|| requestUri.matches("^/oauth2(/.*)?$")
80+
|| requestUri.matches("^/users/dev")
8081
|| requestUri.matches("^/swagger-ui(/.*)?$")
8182
|| requestUri.matches("^/v3/api-docs(/.*)?$"); // OpenAPI 문서 예외 처리
83+
8284
}
8385

8486
private String extractAccessTokenFromCookie(HttpServletRequest request) {

src/main/java/com/example/log4u/domain/user/controller/UserController.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ public ResponseEntity<Void> loginAsDevUser(HttpServletResponse response) {
6666
}
6767

6868
@GetMapping("/test")
69-
public ResponseEntity<Void> loginAsDevTest(
69+
public ResponseEntity<String> loginAsDevTest(
7070
@AuthenticationPrincipal CustomOAuth2User customOAuth2User
7171
) {
7272
if (customOAuth2User == null) {
@@ -75,7 +75,7 @@ public ResponseEntity<Void> loginAsDevTest(
7575
log.debug("customOAuth2UserId: {}", customOAuth2User.getUserId());
7676
}
7777

78-
return ResponseEntity.ok().build();
78+
return ResponseEntity.ok("test login");
7979
}
8080

8181
@GetMapping("/me")

0 commit comments

Comments
 (0)