songining
Spring Securirty 6 ์ด์ƒ ๋ฒ„์ „์—์„œ h2-console 403 ์—๋Ÿฌ ๋‚˜๋Š” ๋ฌธ์ œ
BACKEND/Spring 2023. 1. 23. 17:41

๊ธฐ์กด์— ํ•˜๋˜ ๊ฒƒ ์ฒ˜๋Ÿผ http.requestMatchers("/h2-console/**").permitAll() ๋กœ h2-console์— ๋Œ€ํ•œ ์ ‘๊ทผ์„ ํ—ˆ์šฉํ•ด์ฃผ๋ ค๊ณ  ํ–ˆ์ง€๋งŒ ๊ณ„์†ํ•ด์„œ 403(forbidden) ์—๋Ÿฌ๊ฐ€ ๋‚ฌ๋‹ค. ๊ตฌ๊ธ€๋ง์„ ํ†ตํ•ด ํ•ด๊ฒฐํ•œ ๊ฒฐ๊ณผ @Bean public SecurityFilterChain filterChain(HttpSecurity http) throws Exception { http.authorizeHttpRequests() .requestMatchers("/users/**").permitAll() .and() .authorizeHttpRequests(auth -> auth .requestMatchers(AntPathRequestMatcher.antMatcher("/h2-console/..