์คํ๋ง ์ํ๋ฆฌํฐ ์ต์ ๋ฒ์ ์ฝ๋ ์์๊น์?
์ด๊ฒ ๋ต๋ณ์ด ๋ ์ ์์์ง ๋ชจ๋ฅด๊ฒ ๋๋ฐ์.. ์ ๋ ๊ณต๋ถํ๋ฉด์ ๋ญ๊ฐ ํ๋ ค์ ์ฌ๋ฌ ์ฝ์ง์ ํตํด์ ์ฝ๋ ๋ณ๊ฒฝํด๊ฐ๋ฉด์ ํ๊ณ ์์ด์ @Configuration @EnableWebSecurity @RequiredArgsConstructor public class WebSecurity { private final UserService userService; private final BCryptPasswordEncoder bCryptPasswordEncoder; private final Environment env; private final AuthenticationConfiguration authenticationConfiguration; @Bean public WebSecurityCustomizer webSecurityCustomizer() { return (web) -> web.ignoring().requestMatchers(PathRequest.toStaticResources().atCommonLocations()); } @Bean public SecurityFilterChain filterChain(HttpSecurity http) throws Exception { http.csrf().disable() .authorizeRequests() .antMatchers("/actuator/**").permitAll(); http.csrf().disable() .authorizeRequests().antMatchers("/**") .hasIpAddress("192.168.0.7") .and() .addFilter(getAuthenticationFilter(authenticationConfiguration)) .headers().frameOptions().disable(); return http.build(); } private AuthenticationFilter getAuthenticationFilter(AuthenticationConfiguration authenticationConfiguration) throws Exception { AuthenticationFilter authenticationFilter = new AuthenticationFilter(authenticationManager(authenticationConfiguration), userService, env); return authenticationFilter; } @Bean AuthenticationManager authenticationManager(AuthenticationConfiguration authenticationConfiguration) throws Exception { return authenticationConfiguration.getAuthenticationManager(); } }