-
카테고리
-
세부 분야
백엔드
-
해결 여부
미해결
SecurityConfig 작성할때 새로운 설정방법으로 해도 안돼요
23.03.17 10:55 작성 조회수 1.94k
2
.authorizeRequests()가 계속 빨간줄로 되는데 어떻게 해야하죠 ...?
답변을 작성해보세요.
0
최주호
지식공유자2023.03.17
@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();
}
정정모
질문자2023.03.20
둘 다 해봤는데 동일하게 로그인 화면으로 납치 됩니다...
v2 , v3 보면 antMatchers 로 되어 있는데 버전업그레이드 되면서 authorizeRequests -> authorizeHttpRequests 으로 antMatchers -> requestMatchers 으로 변경된걸로 아는데 그걸로 수정해봐도 안되네요
답변 2