DEV/SPRING
Spring Securtiy 정적 자원 접근 허용
RATSENO
2022. 5. 17. 08:58
@EnableWebSecurity
@EnableGlobalMethodSecurity(prePostEnabled = true, securedEnabled = true)
public class SecurityConfig extends WebSecurityConfigurerAdapter {
@Override
protected void configure(HttpSecurity http) throws Exception {
http.authorizeRequests()
.requestMatchers(PathRequest.toStaticResources().atCommonLocations()).permitAll()
.requestMatchers().hasAnyRole("ADMIN").antMatchers("/").permitAll()
.anyRequest().authenticated();
}
}
.requestMatchers(PathRequest.toStaticResources().atCommonLocations()).permitAll()