Skip to content

Commit c23df86

Browse files
정동하정동하
authored andcommitted
work
1 parent 1284fa4 commit c23df86

File tree

1 file changed

+15
-14
lines changed

1 file changed

+15
-14
lines changed

src/main/kotlin/com/back/koreaTravelGuide/common/security/SecurityConfig.kt

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -46,29 +46,30 @@ class SecurityConfig(
4646
}
4747
}
4848

49-
oauth2Login {
50-
userInfoEndpoint {
51-
userService = customOAuth2UserService
49+
if (!isDev) {
50+
oauth2Login {
51+
userInfoEndpoint {
52+
userService = customOAuth2UserService
53+
}
54+
authenticationSuccessHandler = customOAuth2LoginSuccessHandler
5255
}
53-
authenticationSuccessHandler = customOAuth2LoginSuccessHandler
5456
}
5557

5658
authorizeHttpRequests {
57-
// 인증 없이 접근을 허용할 경로들
5859
authorize("/h2-console/**", permitAll)
5960
authorize("/swagger-ui/**", "/v3/api-docs/**", permitAll)
60-
authorize("/api/auth/**", permitAll) // 토큰 재발급 API
61+
authorize("/api/auth/**", permitAll)
6162
authorize("/favicon.ico", permitAll)
62-
63-
// 소셜 로그인 흐름을 위한 경로 허용
64-
authorize("/login/oauth2/code/*", permitAll)
65-
authorize("/oauth2/authorization/*", permitAll)
66-
67-
// 위에서 허용한 경로 외의 모든 요청은 인증 필요
68-
authorize(anyRequest, authenticated)
63+
if (isDev) {
64+
authorize(anyRequest, permitAll)
65+
} else {
66+
authorize(anyRequest, authenticated)
67+
}
6968
}
7069

71-
addFilterBefore<UsernamePasswordAuthenticationFilter>(jwtAuthenticationFilter)
70+
if (!isDev) {
71+
addFilterBefore<UsernamePasswordAuthenticationFilter>(jwtAuthenticationFilter)
72+
}
7273
}
7374

7475
return http.build()

0 commit comments

Comments
 (0)