Hỏi & Đáp
커스텀 필터 적용 안됨
@Bean public SecurityFilterChain filterChain(HttpSecurity http) throws Exception { AuthenticationManager authenticationManager = http.getSharedObject(AuthenticationManager.class); return http .csrf(AbstractHttpConfigurer::disable) .sessionManagement((sessionManagement) -> sessionManagement.sessionCreationPolicy(SessionCreationPolicy.STATELESS) ) .formLogin(withDefaults()) .httpBasic(withDefaults()) .addFilter(corsConfig.corsFilter()) .addFilter(new JwtAuthenticationFilter(authenticationManager)) .addFilter(new JwtAuthorizationFilter(authenticationManager, userRepository)) .authorizeRequests(requests -> requests .requestMatchers("/user/**").authenticated() .requestMatchers("/admin/**").access("hasAuthority('ADMIN')") .anyRequest().permitAll() ) .build(); } 커스텀 필터를 적용 안하고 커스텀 필터에 코드를 filterchain에 작성하면 어떨까 싶어 위와 같이 작성해보았었으나, 빨간 줄은 안 뜨지만 디버깅해보니 authenticationManager가 null이라고 나왔었습니다..
- Lượt thích
- 0
- Số bình luận
- 1
- Lượt xem
- 967

