인프런 커뮤니티 질문&답변
SecurityConfig 작성할때 새로운 설정방법으로 해도 안돼요
작성
·
2.3K
2
.authorizeRequests()가 계속 빨간줄로 되는데 어떻게 해야하죠 ...?
답변 2
0
최주호
지식공유자
@Bean
SecurityFilterChain filterChain(HttpSecurity http) throws Exception {
   return http
         .csrf().disable()
         .sessionManagement().sessionCreationPolicy(SessionCreationPolicy.STATELESS)
         .and()
         .formLogin().disable()
         .httpBasic().disable()
         .apply(new MyCustomDsl()) // 커스텀 필터 등록
         .and()
         .authorizeRequests()
         .antMatchers("/api/v1/user/**")
         .access("hasRole('USER') or hasRole('MANAGER') or hasRole('ADMIN')")
         .antMatchers("/api/v1/manager/**")
         .access("hasRole('MANAGER') or hasRole('ADMIN')")
         .antMatchers("/api/v1/admin/**")
         .access("hasRole('ADMIN')")
         .anyRequest().permitAll()
         .and().build();
}






흠 .. 버전 문제인거 같습니다 시큐리티 버전 6.0.2 입니다