Skip to content

Commit 88154b4

Browse files
committed
Chore: h2 설정
1 parent eeaf17c commit 88154b4

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

back/src/main/java/com/back/global/security/SecurityConfig.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,10 +46,12 @@ public SecurityFilterChain filterChain(HttpSecurity http) throws Exception {
4646
.csrf(csrf -> csrf
4747
.csrfTokenRepository(repo)
4848
.csrfTokenRequestHandler(reqHandler)
49+
.ignoringRequestMatchers("/h2-console/**")
4950
)
5051
.addFilterAfter(new CsrfCookieFilter(), CsrfFilter.class)
5152
.sessionManagement(sm -> sm.sessionCreationPolicy(SessionCreationPolicy.IF_REQUIRED))
5253
.authorizeHttpRequests(auth -> auth
54+
.requestMatchers("/h2-console/**").permitAll()
5355
.requestMatchers("/api/v1/users-auth/**", "/oauth2/**", "/login/oauth2/**").permitAll()
5456
.requestMatchers("/admin/**").hasRole("ADMIN")
5557
.anyRequest().authenticated()
@@ -83,6 +85,7 @@ public AuthenticationManager authenticationManager(AuthenticationConfiguration a
8385
@Bean // WebSecurityCustomizer Bean 추가
8486
public WebSecurityCustomizer webSecurityCustomizer() {
8587
return (web) -> web.ignoring().requestMatchers(
88+
"/h2-console/**",
8689
"/swagger-ui/**",
8790
"/v3/api-docs/**",
8891
"/swagger-resources/**",

back/src/main/resources/application-test.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,8 @@ spring:
33
url: jdbc:h2:mem:db_test;MODE=PostgreSQL;
44
username: sa
55
password:
6-
driver-class-name: org.h2.Driver
6+
driver-class-name: org.h2.Driver
7+
h2:
8+
console:
9+
enabled: true
10+
path: /h2-console

0 commit comments

Comments
 (0)