@EnableWebSecurity
은 모든 스프링 보안 기본값을 비활성화하므로, WebSecurityConfigurerAdapter
에 필요한 메소드를 재정의했습니다. 그러나, 아무리 내가 CSS를 무엇을하고 다른 모든 고정 자산은 403 또는 https://start.spring.io/스프링 보안 허용 정적 자산이 작동하지 않습니다.
폴더 구조에서 생성 봄 보안 봄 부팅 2.0.0.M7을 사용하여 (405)가
일반
- resources
- static
- css
styles.css
입니다 얻을
web.ignoring()
은 어떤 이유로 아무것도하지 않는, 아직 제가 디버깅을 사용하도록 설정하면 그것은 아래의 경로가 무시되었다는 것을 언급 않습니다하지만 난 여전히 405
@Configuration
@EnableWebSecurity
@EnableGlobalMethodSecurity(prePostEnabled = true)
public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
@Override
public void configure(WebSecurity web) throws Exception {
web.ignoring().antMatchers("/css/**", "/webjars/**");
}
@Override
protected void configure(HttpSecurity http) throws Exception {
http.
authorizeRequests()
.antMatchers("/register").permitAll()
.anyRequest().authenticated();
}
를 얻을 수
}
추가 디버깅을 위해 나는 아래를 수행하여 모든 것을 허용하려했지만 모든 URL은 여전히 혼란스럽고 여전히 혼란스럽고 일부 핵심 개념이 있다고 생각하게 만듭니다.
http.authorizeRequests().antMatchers("/**").permitAll()
마지막으로, 나는 또한 중 하나가 작동하지 않는 위치의 다양한 조합으로 WebMvcConfigurer
을 구현하기 위해 노력했다.
@Configuration
public class WebMvcConfig implements WebMvcConfigurer {
@Override
public void addResourceHandlers(ResourceHandlerRegistry registry) {
registry.addResourceHandler("/css/**").addResourceLocations("/css/");
registry.addResourceHandler("/webjars/**")
.addResourceLocations("/webjars/");
}
아무도 도와 줄 수 있습니까?
그렇기 때문에 405 - 메소드가 허용되지 않습니다. get 요청이 게시물 매핑으로 라우팅되었습니다 :-) –