inflearn logo
Khóa học

Khóa học

Chia sẻ kiến thức

Bài viết của jungmo19975195

jungmo19975195 jungmo19975195

@jungmo19975195

Số lượng đánh giá đã viết
-
Xếp hạng trung bình
-

Bài viết 1

Hỏi & Đáp

주의! WebSecurityConfigurerAdapter deprecated

줄 안생김 @Configuration @EnableWebSecurity // 스프링 시큐리티 필터가 스프링 필터체인에 등록된다. public class SecurityConfig { @Bean public SecurityFilterChain filterChain(HttpSecurity http) throws Exception { http.csrf(CsrfConfigurer::disable); // http.sessionManagement().sessionCreationPolicy(SessionCreationPolicy.STATELESS); http.sessionManagement((sessionManagement) -> sessionManagement .sessionCreationPolicy(SessionCreationPolicy.STATELESS)); // http.formLogin().disable(); http.formLogin((form)-> form.disable()); // http.httpBasic().disable(); http.httpBasic((basic)-> basic.disable()); http.authorizeHttpRequests(authorize -> authorize.requestMatchers("/user/**").authenticated() .requestMatchers("/manager/**").hasAnyRole("ADMIN", "MANAGER") .requestMatchers("/admin/**") .hasAnyRole("ADMIN").anyRequest().permitAll()); return http.build(); } }

Lượt thích
15
Số bình luận
8
Lượt xem
4604